stevepryde/thirtyfour

timeout for .query

Closed this issue · 2 comments

Im querying a few products on a page, one element isn't always there so .query will wait around 10 seconds or something to finally error out.

    driver
        .set_implicit_wait_timeout(Duration::new(3, 0))
        .await?;

Im setting the time out for 3 seconds due to other elements needing to load in from the JS, but that does not account for the other 7 seconds

Don't use the implicit wait timeout setting. That has an entirely different meaning and will actually conflict with the way query() works. Implicit waits in selenium will occur in the underlying webdriver itself (ie chromedriver or geckodriver). However the query() interface expects the implicit wait to be zero and it will instead poll at regular intervals, with its own timeout period.

If you want to change the default wait time for the query interface you can set a different ElementPoller with the set_query_poller() method on WebDriver.

If you only want to change the timeout for a single query you can use query().wait(...).

Hope this helps.

Thanks, this helped me out a ton!