I'm navigating to a webpage using Firefox driver. The page is loaded correctly but I'm getting this exception and the test crashes

Timed out waiting for page load

I've tried to add some Thread.Sleep(); and explicit waits but still getting the same error.

Is there a work-around to get rid of this problem??

  • put an explict timeout and load the page, i guess page is not getting completely loaded within implicit time driver.get() command which it is used. – saikrishna Oct 13 '14 at 7:31

Have you tried to use WaitForReadyState?

Here is my example:

 /// <summary>
        /// Waits the state of for ready within 30 sec.
        /// </summary>
        public void WaitForReadyState()
            var state = string.Empty;
                var wait = new WrapperSeleniumWait(this, TimeSpan.FromSeconds(30));
                wait.Until(wrapper =>
                    state = JSExecutor.ExecuteScript(@"return document.readyState").ToString();
                    return state.Equals("complete", StringComparison.InvariantCultureIgnoreCase);
            catch (WebDriverException)
                if (WindowHandles.Count != 1) return;
                state = JSExecutor.ExecuteScript(@"return document.readyState").ToString();
                if (!(state.Equals("complete", StringComparison.InvariantCultureIgnoreCase))) throw;
  • nope I didn't try that, I'll try it and I'll keep you posted with the result. thanks :) – nabil Oct 7 '14 at 10:10
  • Infact, I'm still getting the same error,but I just wanted to add that this error occurs in the Click() method on a WebElement object – nabil Oct 7 '14 at 10:28
  • Hmm, it's another question. Try to click in a such way:pastebin.com/bwYrPGtC – Legion Oct 7 '14 at 10:47

I would recommend using a WebDriverWait along with one of the methods in the ExpectedConditions class. Basically, just wait for a element on the page using a pre-defined expected condition.


I faced similar kind of problem earlier. Here is my suggestions 1- Don't just wait for page to load write a logic for it.Try to make several attempts after a given interval. (refer below mention code. language is perl) e.g.

my $wait =some_value;
my $url ="something";

print "$i attempt became unsuccessful.";

print "Got the url in $i attempt";

print "All attempts failed.";

2- Some times its not a selenium problem. Since selenium starts a news instance of firefox , it check for the certificate which is going to be loaded. If you have demo certificate try to add it to firefiox manually.

3- Check your firewall settings. Some routers block automated queries. e.g. If you are using belkin router they have an explicit firewall build in the router. Disable it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.