I am using Selenium 2.20 WebDriver to create and manage a firefox browser with C#. To visit a page, I use the following code, setting the driver timeouts before visiting the URL:
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5)); // Set implicit wait timeouts to 5 secs
driver.Manage().Timeouts().SetScriptTimeout(new TimeSpan(0, 0, 0, 5)); // Set script timeouts to 5 secs
driver.Navigate().GoToUrl(myUrl); // Goto page url
The problem is that sometimes pages take forever to load, and it appears that the default timeout for a page to load using the selenium WebDriver is 30 seconds, which is too long. And i don't believe the timeouts i am setting apply to the loading of a page using the GoToUrl() method.
So I am trying to figure out how to set a timeout for a page to load, however, I cannot find any property or method that actually works. The default 30-second timeout also seems to apply to when I click an element.
Is there a way to set the page load timeout to a specific value so that when I call the GoToUrl() method it will only wait my specified time before continuing?