I've written a script to select certain field from a webpage using python with selenium. There is a dropdown on that page from which I want to select "All". However, i tried many different ways with my script to make it but could not. Here is how the dropdown look like.
Html elements for the dropdown selection:
<select name="ctl00$body$MedicineSummaryControl$cmbPageSelection" onchange="javascript:setTimeout('__doPostBack(\'ctl00$body$MedicineSummaryControl$cmbPageSelection\',\'\')', 0)" id="ctl00_body_MedicineSummaryControl_cmbPageSelection">
<option selected="selected" value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="all">All</option>
</select>
Scripts I've tried with:
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get('http://apps.tga.gov.au/Prod/devices/daen-entry.aspx')
driver.find_element_by_id('disclaimer-accept').click()
time.sleep(5)
driver.find_element_by_id('medicine-name').send_keys('pump')
time.sleep(8)
driver.find_element_by_id('medicines-header-text').click()
driver.find_element_by_id('submit-button').click()
time.sleep(7)
#selection for the dropdown should start from here
driver.find_element_by_xpath('//select[@id="ctl00_body_MedicineSummaryControl_cmbPageSelection"]').click()
driver.find_element_by_xpath('//select//option[@value]').send_keys("All")
