SOLVED! HTTP request to the remote WebDriver server for URL http://localhost:52847/….. timed out after 60 seconds.

I can finally sleep again! Just kidding …

For a few weeks, when running Selenium tests in Teamcity, once in a while, I would see tests failing with the following exception:

The HTTP request to the remote WebDriver server for URL http://localhost:52847/session/a56bcb818246209e5d359626409731ac/element/13961238-cb66-437e-9154-1c150eebaf70/value timed out after 60 seconds.

stack trace: at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo) at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute) at

OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteWebElement.SendKeys(String text)

This exception would happen sometimes when executing the SendKeys() method, other times when using Click() or Text() or Displayed(). Or any other IWebElement interface  method (C#).

I do not think that it was caused by the C# code because when running the same code locally, the exception would never happen.

It only happened when running the Selenium tests in Teamcity, on virtual machines hosted in Azure.

The Chrome driver was created in a very straightforward way:

 ChromeOptions options = new ChromeOptions();
 ChromeDriver drv = new ChromeDriver(options);

OK, what now?

My suspicion is that the exception is happening because

  • either the Teamcity agent (where the UI tests run) is very slow or
  • the site is slow


I have searched for a solution for days.

Some people suggested adding the no-sandbox option:


It did not help.

Others advised that this may be caused by conflicting versions of software (chrome driver, selenium, etc).

Or that the code is causing it and I should use explicit waits (already doing it) instead of implicit waits.

Or that drivers or browsers were not closed correctly.

Or that I should clean temporary files.

Or that Teamcity is causing it.

None of these really helped.

What helped was creating the Chrome driver differently and specifying a timeout for it.

Also, increasing the page load timeout as follows:

 ChromeOptions options = new ChromeOptions();

 ChromeDriver drv = new ChromeDriver(ChromeDriverService.CreateDefaultService(), options, TimeSpan.FromMinutes(3));


I can sleep again since doing this.

I still get this exception when running UI tests in Teamcity.

But with 95% reduced frequency.

And yes, I still believe that it is somehow related to the site being very slow, occasionally.



Selenium Tips and Tricks


I post once in a while tips and tricks for Selenium and Java on Quora.

This is the list of the tips published so far:

Use a detailed error message with assertTrue

Do not chain methods of different classes