0 votes
1 view
in Devops and Agile by (18.3k points)

Using Selenium for UI tests on our project. We are running the newest version 2.30.0. We use Firefox WebDriver and are running Firefox 19.0.

Generally said the UI test works local and even server-side when I run the UI test in Visual Studio. Our UI tests get executed nightly on our build server. It uses the same deploy on the same server I test manually via Visual Studio.

But sporadically we run into the following issue when the UI test gets executed on build server:

Test(s) failed. OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:7056/hub/session/bed1d0e7-efdc-46b6-ba07-34903519c44d/element/%7B8717bb19-96c7-44d3-b0ee-d4b989ae652d%7D/click timed out after 60 seconds.

      ----> System.Net.WebException : The operation has timed out

       at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)

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

--WebException

   at System.Net.HttpWebRequest.GetResponse()

   at OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request)

Basically, the test clicks on an upload button where the input field was filled with a file before. Since the file is very small this gets done in a few seconds. Nevertheless, the timeout of 60 seconds is reached sometimes.

Any ideas on how to isolate the underlying issue? Or run anybody into the same issue before? Any hints appreciated. Thanks.

1 Answer

0 votes
by (48.8k points)

In selenium, the wait command doesn't really wait sometimes. That is there is some problem with that command.

You can try the time.sleep(); command of python. It is an equivalent of the Thread.sleep(); command of Java.

It will pause the execution of code for the defined time limit. So you can give sufficient time that will allow your page to load.

Or you can try the below code:

driver = webdriver.Firefox()

driver.implicitly_wait(10) # seconds

driver.get("http:// enter your URL.") 

myDynamicElement = driver.find_element_by_id("myDynamicElement")

I hope it helps!

...