Reputation: 2082
I'm having this problem with both selenium 3.40 and 3.39 (I don't know what about previous versions).
After a time period that selenium is running (and executing) my test stuck and fail on "find element" and throws the following exception:
OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL
http://localhost:7055/hub/session/44f53200-6259-4f38-8738-b4beda40429f/elements
timed out after 60 seconds. ---> System.Net.WebException: The operation has timed out at System.Net.HttpWebRequest.GetResponse() at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) --- End of inner exception stack trace --- 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.FindElements(String mechanism, String value) at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementsByXPath(String xpath) at OpenQA.Selenium.By.<>c_DisplayClasse.b_d(ISearchContext context) at OpenQA.Selenium.By.FindElements(ISearchContext context) at OpenQA.Selenium.Remote.RemoteWebDriver.FindElements(By by)
This issue is a matter of how long selenium is running: When running a test alone, it does not happen. But when I run a test as a part of many tests, it happens.
A call that comes after a one which fails can succeed.
Happen also with chrome. I tried going back so Selenium 2.34 and the problem still exist.
Upvotes: 1
Views: 636
Reputation: 2082
I found it: I set
WebDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(60));
somewhere in my code, this causes every element lookup to wait for 60 seconds for the element to appear.
Upvotes: 2
Reputation: 29062
According to your confirmation, I can say that you are getting this issue because your WebDriver
object is static
. You can run your tests fine one by one, but once you try to run multiple at a time, the JVM considers your different tests to have the same WebDriver
object! Funny, huh..
Find a way to remove the static
modifier from your object, which will most likely require you to change your entire structure, and it WILL fix your issue.
Source:
An experienced user of Selenium who's had this issue before trying to run multiple tests, and recieved the same sort of behavior, and fixed it by following the steps above.
Upvotes: 1