0

Code producing timeout error:

>>> wait.until(ec.visibility_of_element_located(('xpath', '//*[@id="ucf_table"]/tbody/tr[1]/td[2]/a')))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Harrison Pollock\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
>>> codes = driver.find_element_by_xpath('//*[@id="ucf_table"]/tbody/tr[1]/td[2]/a')
>>> print(codes.text)

Attempt at inserting timeout:

>>> def my_func():
...     with timeout(1):
...             wait.until(ec.visibility_of_element_located(('xpath', '//*[@id="ucf_table"]/tbody/tr[1]/td[2]/a')))
...             import time
...             time.sleep(10)
  • is your `wait` declared somewhere as `wait= WebDriverWait(driver,timeoutInSeconds)`? that timeoutInSeconds is configurable so I just check for the line with the specified time in your script. – supputuri Apr 14 '20 at 04:18
  • Yes, I have the line 'wait = WebDriverWait(driver, 5)', but still get timeout message. –  Apr 14 '20 at 05:25
  • TimeoutException, occurs when your //*[@id="ucf_table"]/tbody/tr[1]/td[2]/a element is not found check if your element is present or else increase waiting time – SeleniumUser Apr 14 '20 at 07:21
  • Post your Relevant HTML and mentioned what you are after? – KunduK Apr 14 '20 at 08:32
  • Have you tried increasing the time? And if the script is still failing then check if the element is present in the iframe using `//*[@id="ucf_table"]/ancestor::html`. – supputuri Apr 14 '20 at 13:13
  • Have you tried increasing the time? If that did not work, then check if the element is present in the iframe using `//*[@id="ucf_table"]/ancestor::html` in the chrome devtools as shown here[here](https://stackoverflow.com/questions/55870609/is-there-a-way-to-learn-xpath-without-using-firebug-or-xpath-as-firefox-is-not-s/55870909#55870909). – supputuri Apr 14 '20 at 13:16

0 Answers0