0

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?

This is the available xpath.enter image description here enter image description here

eightmax
  • 13
  • 4
  • Could you add the xpath that you tried? Or have you look into [link](https://stackoverflow.com/questions/7867537/how-to-select-a-drop-down-menu-value-with-selenium-using-python) – Millie Anne Volante Oct 08 '20 at 03:13

1 Answers1

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