Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

403
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!