pythonselenium-webdriverwebdriverwait

Python Selenium: How can I specify a "no timeout" WebDriverWait?


I'm using Selenium WebDriverWait in a Python function decorated with @timeout(). Since timeout is handled at the function level, I really don't need WebDriverWait to timeout. Is there a way to have a WebDriverWait instance with no timeout?


Solution

  • I'm not quite sure why you would want to do this, but...

    WebDriverWait requires a timeout value. I think the closest you can get to an instance that never times out is something like:

    import sys
    from selenium.webdriver.support.wait import WebDriverWait
    
    wait = WebDriverWait(driver, timeout=sys.maxsize)