I am using Unit test in Python and I used Select in Python Selenium but not able to select values, so please suggest me to select values from Drop down box
Please check below is my code:
self.login_element= Select(self.driver.find_element_by_xpath('//*[@name="field_DOBDay"]'))
self.login_element.select_by_visible_text('01')
self.login_element.select_by_index('1')
self.login_element.select_by_value('1')
I don't have information about your html source but,
Please try following code with specific optionText, option_text should exactly match with options text:
find_element_by_xpath("//*[@name="field_DOBDay"]/option[text()='option_text']").click()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.