I couldn’t find at Stackoverflow on how to increase the timeout and the Selenium API not that easy to find on how to use it.
For Selenium WebDriver using NodeJS below is how to increase its time outs. The number is in milliseconds.
1 2 3 4 5 6 |
let driver = await new Builder().forBrowser('chrome') .setChromeOptions(new chrome.Options().headless()) .setFirefoxOptions(new firefox.Options().headless()) .build(); driver.manage().setTimeouts({implicit: 120000, script: 120000, pageLoad:120000}); |
From Selenium Documentation
The following timeouts are supported (all timeouts are specified in milliseconds):
- implicit specifies the maximum amount of time to wait for an element locator to succeed when locating elements on the page. Defaults to 0 milliseconds.
- pageLoad specifies the maximum amount of time to wait for a page to finishing loading. Defaults to 300000 milliseconds.
- script specifies the maximum amount of time to wait for an evaluated script to run. If set to null, the script timeout will be indefinite. Defaults to 30000 milliseconds.