jeudi 26 septembre 2019

Python Selenium webdriver timeout exception

I'm working on a project to extract some data from a website. In this website there is search form that I should fill it. One of the inputs which is text, shows a suggestion after entering 2 or 3 characters and I should select that option in order to go forward or search button will be activated. The problem is that when I use the following code:

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='LocationSuggestionBox']/ul/div/li/div"))).click()

I modified the xpath in above code. The actual xpath is as fllow:

//*[@id="LocationSuggestionBox""]/ul/div/li/div

But I don't know how to add it in my code to not get the syntax error.

The final result with my working code is :

    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//*[@id='LocationSuggestionBox']/ul/div/li/div"))).click()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/support/wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 



Aucun commentaire:

Enregistrer un commentaire