I've tried to get list of all values from dropdown.
The problem is the dropdown is activated after click on it. The list of values shows only after click on dropdown
Now I've got code like this:
browser.find_element_by_xpath("/html/body/div[3]/div[8]/div[2]/div[1]/div[4]").click()
It enable me to activate dropdown but I don't know completely how to extract all possible values from this dropdown
HTML:
<option value="">-</option><option value="0401">Aleksandrowski</option><option value="2001">Augustowski</option>
Use Select:
As per the best practices, you can add WebDriverWait and expected_conditions as follows:
Hope this helps you!
I must suggest do not use absolute
XPath
. Try to use relativeXpath
.Please find the following code to retrieve the drop-down values.Output Printed on console