I am automating an internal website whose pages use many Angular-based lazy loading strategies. I frequently encounter pages where Chromedriver will "hang" and the Driver becomes completely unresponsive - every Selenium call I make to FindElement
, Refresh()
, Url
, will all time out & not return anything.
To test the Driver when it is in this state, I run the following lines of code as an attempt to "diagnose":
var url = Driver.Url;
var anyElements = Driver.FindElements(By.XPath("//*"));
Driver.Navigate().Refresh();
All of these commands result in the same respective error:
OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:49799/session/6cdb197c3bcffde5bc5b0f03e5bbe6f6/elements timed out after 60 seconds. ----> System.Net.WebException : The operation has timed out
OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:49799/session/6cdb197c3bcffde5bc5b0f03e5bbe6f6/url timed out after 60 seconds. ----> System.Net.WebException : The operation has timed out
OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:49799/session/6cdb197c3bcffde5bc5b0f03e5bbe6f6/refresh timed out after 60 seconds. ----> System.Net.WebException : The operation has timed out
When the Driver gets into this state, I cannot even call Driver.Close()
or Driver.Quit()
which is a huge problem - these commands also time out.
If I manually click anywhere on the web page, suddenly the Driver becomes responsive again and starts working as expected. But purely letting the automated test run on its own (with no manual intervention) consistently results in Driver getting hung up & unresponsive.
I would expect something as simple as Driver.Url
, no matter the content of the page, would always return something given how simple the command is, but Selenium is timing out even with this simple command.
I have tried setting the page load strategy to both Eager
and None
with no luck.
I believe my issue is similar to what is described here, but this question does not have an answer that works for me: Selenium WebDriver loses connection to web page
Does anyone have suggestions for what I can do to get my Driver responsive again? I can reproduce the behavior consistently but unfortunately I cannot share the website I am testing, as it is internal to my company. Any suggestions to further narrow down the issue are appreciated. I have never seen anything like this before.