Iam using selenium on python and try to select a value on a dropdown list, but I cant find the xpath for the value. The second picture is how it looks when I manually select the value five. Can somebody help me to click on a certain value of the dropdown list?
Asked
Active
Viewed 28 times
1 Answers
0
If you know the values, it's much more robust to use Select:
from selenium.webdriver.support.ui import Select
select = Select(driver.find_element_by_name('select2-selection'))
select.select_by_visible_text("Item 1")
There are also
select.select_by_index(index)
select.select_by_value(value)
that you can try.

ou_ryperd
- 2,037
- 2
- 18
- 23