When I call the Open("[some URL]") method in Selenium, it waits until all resources (images, CSS, JS) are downloaded. But how does it know that the browser is done requesting resources?
Here's my snippet of driver code (in C#):
DefaultSelenium selenium = new DefaultSelenium(
"localhost", 4444, "*iexplore", "http://www.stackoverflow.com");
// open my profile page
selenium.Open("http://stackoverflow.com/users/111934/jeff-meatball-yang");
The URL above is for example only. In the case where I have an AJAX call wrapped in a very long delay in a setTimeout()
triggered in the body onload
event handler, Selenium won't actually wait for that AJAX call before continuing... I have to manually tell Selenium to wait using WaitForPageToLoad(timeout)
.
So how does Selenium detect when a normal page (without AJAX) is finished loading?