Loading page generates exception 'Timed out waiting for page load'



  • 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??



  • 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; try { 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; SwitchToWindow(WindowHandles[0]); state = JSExecutor.ExecuteScript(@"return document.readyState").ToString(); if (!(state.Equals("complete", StringComparison.InvariantCultureIgnoreCase))) throw; } }



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2