0

How do I run ExecuteScript before document ready? The page is already rendered but some scripts that is not relative to the display (such google analytics) are still downloading (and it's very slow).

var driver = new ChromeDriver();
driver.ExecuteScript("window.location='https://veryslowendblockscriptloading.com';"); 
driver.ExecuteScript("alert('bonjour')"); // This line takes forever to load even if it's independent of DOM. 

I'm using Selenium Webdriver on Chrome 59. This behaviour is only on Chrome.

What I've tried.

I tried to set driver.Manage().Timeouts().PageLoad to short value (5 seconds) but it looks like webdriver stop loading page (as if i press escape button) when the timeout reached and I don't need this behaviour

It's not a duplicate question as my issue is only on chromedriver.

Pablo Honey
  • 1,074
  • 1
  • 10
  • 23
  • Possible duplicate of [How to make Selenium not wait till full page load, which has a slow script?](https://stackoverflow.com/questions/44770796/how-to-make-selenium-not-wait-till-full-page-load-which-has-a-slow-script) – undetected Selenium Dec 07 '17 at 10:44
  • You can also have a look at [`Don't wait for a page to load using Selenium in Python`](https://stackoverflow.com/questions/46322165/dont-wait-for-a-page-to-load-using-selenium-in-python/46339092#46339092) and [`Wait for page to load`](https://stackoverflow.com/questions/47130366/wait-for-page-to-load/47131397#47131397) – undetected Selenium Dec 07 '17 at 10:51

0 Answers0