Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

409
Vistas
Selenium (python) to select an item in dropdown menu

I am trying to use Selenium in python to select an item "Custom date" in the following dropdown menu: enter image description here

This is how the structure of divs looks like: enter image description here

I try to first select the topmost div with Selenium (python) and then progress down by clicking all the way to "Custom date" (see code below). However, I get the following error in the last line of code when I try to do that:

"ElementNotInteractableException: Message: element not interactable"

My attempt to click the desired field:

time.sleep(2)
element=chrome.find_element_by_xpath("//div[@class='Inputreact__StyledContainer-sc-3dr67n-0 iAeYiQ Selectreact__SelectInput-sc-1shssly-0 cJLIjY' ]")
element.click()
chrome.execute_script("arguments[0].click();", element)
element=chrome.find_element_by_xpath("//input[@value='7 days']")
chrome.execute_script("arguments[0].click();", element)
element=chrome.find_element_by_xpath("//input[@value='Custom date']")
chrome.execute_script("arguments[0].click();", element)

EDIT: I want to provide a bit more detail. In the case of user MANUALLY using the dropdown menu, the behavior below happens (note what the relevant divs are in the picture). I am stumped because selenium clicking on the div that ends in ePfTsZ DOES NOT EXPAND the dropdown menu, as happens when user manually does it in the browser.

enter image description here

about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

In this case you need to use the Select class, will look something like this:

from selenium.webdriver.support.select import Select

selection = Select(chrome.find_element_by_xpath(
    "//div[@class='Inputreact__StyledContainer-sc-3dr67n-0 iAeYiQ Selectreact__SelectInput-sc-1shssly-0 cJLIjY' ]"))

After this you can select any item of the dropdown by index or by visible text.

selection.select_by_index(1)

or

selection.select_by_visible_text("A month")
about 4 years ago · Santiago Trujillo Denunciar

0

If you want to go through all the option of the dropdown, then run a loop on index.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda