1

I am trying to read elements from the page using selenium but it seems the page is getting loaded infinitely. The element which I want to read is visible on the page (tried xpath and I was able to fetch the element). I tried the below code to execute the javascript command to stop the page load but for some reasons it is getting time out.

driver.executeScript("window.stop());
Hirein
  • 135
  • 5
  • 20
  • Is there a way you can stop the dynamic web page loading manually ? – cruisepandey Aug 19 '21 at 16:42
  • might be able to set PageLoadStrategy so that Selenium doesn't wait for the page to load. In that mode you might be able to send escape key... but not real sure if you'll be able to inject anything into an infinitely loading page. See this thread for PageLoadStrategy options: https://stackoverflow.com/questions/43734797/page-load-strategy-for-chrome-driver-updated-till-selenium-v3-12-0 – pcalkins Aug 19 '21 at 17:22

1 Answers1

2

As @pcalkins suggested to use PageLoadStrategy, I used the "none" strategy in the chrome capabilities and it really did work. Below is the chrome capability property which I set.

"pageLoadStrategy" : none 
Hirein
  • 135
  • 5
  • 20