June 2018
Beginner to intermediate
376 pages
8h 58m
English
This defines the amount of time that Selenium will wait for a page to load. By default, it is set to 0 (which equates to an infinite time out). If you want to ensure that an error is thrown if your page takes longer than expected to load, you can modify this by using this line of code:
driver.manage().timeouts().pageLoadTimeout(15, TimeUnit.SECONDS);
If your page does not load within 15 seconds, WebDriverException will be thrown.
You should of course be aware that, while Selenium does its best to ensure that the page is loaded, you should not rely on it. With a simple website with no JavaScript manipulation of the DOM or AJAX requests firing away in the background, Selenium will be pretty accurate. With modern websites, ...
Read now
Unlock full access