E
E
EgorLee2021-05-24 01:38:33
Python
EgorLee, 2021-05-24 01:38:33

Can't select Selenium dropdown list?

Good evening. There was a problem when automating the browser on the site mos.ru
I can not select an element from the drop-down list, I tried both by value and by visible text, the code in python:

select = Select(driver.find_element_by_name('field[internal.new_okrug]'))
select.select_by_visible_text('Восточный административный округ')

Error (when selecting by value, the same error):
Message: element not interactable: Element is not currently visible and may not be manipulated
  (Session info: chrome=90.0.4430.212)


60aad890e62a7100650880.jpeg

In Firefox it shows event:
60aad8e9782df042885442.jpeg
60aad90359e8f578383888.jpeg

Checkboxes and radio buttons are perfectly clickable with:
category = driver.find_element_by_xpath(r'//*[@id="field[internal.person_type]-1"]')
driver.execute_script("arguments[0].click();", category)

but this does not work with lists :( I have been
struggling with this problem for a day (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
EgorLee, 2021-05-24
@EgorLee

I also noticed that the "li" tag is clickable on the Xpath if I open the list manually, but how can I automate this so that the list item is selected without my help?

select = driver.find_element_by_xpath('//*[@id="step_1"]/fieldset[1]/div[9]/div[1]/div[1]/div/div/ul/li[7]')
select.click()

60aae439a5660304516393.jpeg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question