Selenium Error - HTTP request to remote WebDriver expires after 60 seconds

I have been using Selenium for several months, which we use to automate some of our internal testing processes. The scripts went fine. I recently upgraded to C # 2.40.0 webdriver using FF 27.01, and our scripts now fail in random places with the following error.

[Portal.SmokeTest.SmokeRunTest.Booking] TearDown method failed. OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL htt(p)://localhost:7055/hub/session/56e99e88-ba17-4d12-bef1-c6a6367ccc2f/element timed out after 60 seconds. ----> System.Net.WebException : The operation has timed out TearDown : OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL htt(p)://localhost:7055/hub/session/56e99e88-ba17-4d12-bef1-c6a6367ccc2f/window timed out after 60 seconds. ----> System.Net.WebException : The operation has timed out [09:01:20] [Portal.SmokeTest.SmokeRunTest.Booking] TearDown method failed. OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL htt(p)://localhost:7055/hub/session/56e99e88-ba17-4d12-bef1-c6a6367ccc2f/element timed out after 60 seconds. ----> System.Net.WebException : The operation has timed out TearDown : OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL htt(p)://localhost:7055/hub/session/56e99e88-ba17-4d12-bef1-c6a6367ccc2f/window timed out after 60 seconds. ----> System.Net.WebException : The operation has timed out at OpenQA.Selenium.Support.UI.DefaultWait`1.PropagateExceptionIfNotIgnored(Exception e) at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition) at Portal.Test.Helpers.Process_Bookings.OpenBookings.SelectBooking(String bookingnumber) at Portal.SmokeTest.SmokeRunTest.Booking() in d:\TeamCityAgent\work\dac1dcea7f2e80df\SmokeTests\SmokeRunTest.cs:line 68 --WebException at System.Net.HttpWebRequest.GetResponse() at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) --TearDown at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute) at OpenQA.Selenium.Firefox.Internal.ExtensionConnection.Execute(Command commandToExecute) at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) at OpenQA.Selenium.Remote.RemoteWebDriver.Close() at Portal.Test.Helpers.Setup.CloseWebdriver() at Portal.SmokeTest.SmokeRunTest.TearDown() in d:\TeamCityAgent\work\dac1dcea7f2e80df\SmokeTests\SmokeRunTest.cs:line 162 --WebException at System.Net.HttpWebRequest.GetResponse() at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) 

The last error that I was able to search for a single line of code:

 _setup.driver.FindElement(By.XPath("//button[@class='buttonSmall lockBookingButton']")).Click(); 

It’s annoying that trying to fix the problem is difficult, as if I ran the test on my local machine, it goes through in debugging. Also, if I run it through the NUNIT runner on the build machine, I run the test, it also passes. This does not seem to be the case as part of our automatic build process when using Teamcity. As I said, that was nice for a few months ago, and the only thing that has changed is the selenium web selenium kit.

I ran into this problem earlier, while in debugging, and when the Click() line of code was called, Firefox seemed to block, and only stopping the test would allow Firefox to continue. Are there several suggestions here, including changing the webdriver source? I would not want to go down this route, if possible, if anyone else can offer any suggestions.

+70
c # selenium nunit selenium-webdriver teamcity
Mar 11 '14 at 10:13
source share
14 answers
 new FirefoxDriver(new FirefoxBinary(),new FirefoxProfile(),TimeSpan.FromSeconds(180)); 

Launch your browser using the lines of code above. It worked for me.

+20
May 08 '15 at 4:22
source

I had a similar problem using the Chrome driver (v2.23) / running tests through TeamCity. I was able to fix the problem by adding the "no-sandbox" flag in the Chrome options:

 var options = new ChromeOptions(); options.AddArgument("no-sandbox"); 

I am not sure if there is a similar option for the FF driver. From what I understand, the problem is that TeamCity works with Selenium under the SYSTEM account.

+17
Sep 02 '16 at 19:57
source

I first encountered this problem a few months ago (also in the click() command), and since then it has been a problem for me. This seems to be some kind of problem with .NET Selenium bindings. This blog post that works in the IE driver is useful for explaining what is happening:

http://jimevansmusic.blogspot.com/2012/11/net-bindings-whaddaymean-no-response.html

Unfortunately, there is no real solution to this problem. Whenever this problem was raised by Selenium developers ( see here ), this is a typical answer :

We need a reproducible script that should include a sample page or a link to a page on a public site where the problem can be reproduced.

If you can imagine a sequentially reproduced test case, this can be very useful so that this bug remains forever.

However, perhaps you can try this workaround in the meantime. If the HTML button you are trying to use click() has an onclick attribute that contains Javascript, consider using a JavascriptExecutor to execute this code, rather than calling the click() command. I found that running javascript onclick directly allows me to pass some of my tests.

+13
Apr 17 '14 at 15:49
source

A similar problem. Try to set more time in the driver constructor - add, for example.

 var timespan = TimeSpan.FromMinutes(3); var driver = new FirefoxDriver(binary, profile, timeSpan); 
+3
Mar 11 '14 at 11:11
source

In my case, my button type is submit not button , and I change Click to Sumbit , then each work is good. Something like below

from driver.FindElement(By.Id("btnLogin")).Click();

to driver.FindElement(By.Id("btnLogin")).Submit();

By the way, I tried the whole answer in this post, but did not work for me.

+3
Feb 01 '16 at 6:36
source

I think this problem occurs when you try to access the web driver object after

1) the window has closed and you have not yet switched to the parent

2) you switched to a window that was not quite ready and updated since you switched

expecting windowhandles.count be what you expect does not take into account the contents of the page and does not make document.ready. I'm still looking for a solution to this problem

+2
Feb 29 '16 at 10:17
source

In my case, this is because I deleted the Chrome update folder. After reinstalling chrome, everything works fine.

+2
Nov 16 '18 at 6:11
source

The problem is that the Click() evaluation expires on your env assembly .. you might want to delve into what's happening on Click() .

Also, try adding Retrys for Click() , because later it takes more time to evaluate depending on network speed, etc.

+1
Mar 11 '14 at 10:21
source

In my case, I found that this error occurs in our server building commands. Tests worked on our local machines.

The problem was that the target site was not configured correctly on the build server, so it could not open the browser correctly.

We used the chrome driver, but I'm not sure if that matters.

+1
Nov 11 '16 at 15:43
source

I'm quite happy with changing Selenium.WebDriver.ChromeDriver from 2.40.0 to 2.27.0

0
Jun 19 '18 at 7:27
source

In my case, the problem was with SendKeys () and Remote Desktop . Putting a workaround so far away from me:

I had a Selenium test that failed while running a Jenkins job on a host hosted in vSphere and administered through RDP. After some troubleshooting, it turned out that it was successful if the remote desktop is connected and focused, but fails, except that the remote desktop is disabled or even minimized.

As a workaround, I logged in via vSphere Console instead of RDP, and then even after closing vSphere, the test no longer passed. This is a workaround, but I have to be careful to never log in through RDP and always administer only through vSphere Console.

0
Apr 10 '19 at 14:43
source

new FirefoxDriver(binary, profile, timeSpan) deprecated.

Now you can use new FirefoxDriver(FirefoxDriverService.CreateDefaultService(), FirefoxOptions options, TimeSpan commandTimeout) .

There is also a new FirefoxDriver(string geckoDriverDirectory, FirefoxOptions options, TimeSpan commandTimeout) and it works. But it is undocumented, and you need to manually specify geckoDriverDirectory even if it is already specified in Path .

0
May 30 '19 at 5:36
source

We had the same problem. In our case, the browser was blocked by a pop-up login window (Windows authentication), so it did not return after 60 seconds. Adding the correct permissions to the Windows account in which Chrome was running solved the problem.

0
Jul 12 '19 at 5:26
source

For ChromDriver, the following works for me:

 string chromeDriverDirectory = "C:\\temp\\2.37"; var options = new ChromeOptions(); options.AddArgument("-no-sandbox"); driver = new ChromeDriver(chromeDriverDirectory, options, TimeSpan.FromMinutes(2)); 

Selenium version 3.11, ChromeDriver 2.37

-one
Mar 19 '18 at 17:11
source



All Articles