Skip to content Skip to sidebar Skip to footer

Selenium Python - Select From Autosuggest Dropdown

I'm trying to select the first value of the drop down from the autosuggested list when I use sendkey with a value of 'ada' into the 'Enter Company' field on the following page. htt

Solution 1:

Try to wait until required option appears in DOM:

from selenium.webdriver.support.ui import WebDriverWait as wait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

driver.find_element_by_id("mycomp").send_keys('ada')
wait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="suggest"]/ul/li[1]'))).click()

Post a Comment for "Selenium Python - Select From Autosuggest Dropdown"