navigate to url without waiting for page to load

  • 1 Replies
  • 1434 Views
navigate to url without waiting for page to load
« on: June 21, 2016, 18:22:04 pm »
When I navigate with driver.get() the driver seems to be waiting for the entire page to load before proceeding.

Is it possible to tell the driver to not wait for the entire page to load?
Several of the pages that I'm loading have heavy external resources that take too long to fetch.

I'm more interested in the DOM elements to be present than wait for everything to load. Some tests take double the time because of this

Re: navigate to url without waiting for page to load
« Reply #1 on: June 27, 2016, 19:24:39 pm »
It is possible only in firefox while running in special mode.

You have to set preference in firefox profile beforehand:

Code
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("webdriver.load.strategy", "unstable");
WebDriver driver = new FirefoxDriver(profile);

Then you can set a timeout:
Code
driver.manage().timeouts().pageLoadTimeout(3, TimeUnit.SECONDS);

 

Sitemap 1 2 3 4 5 6 7 8