Timothy Rajan
Timothy Rajan

Reputation: 1957

Selenium - Exception - Connection getting closed

I am using the latest Selenium WebDriver running using .NET/Microsoft Technology stack.

What I am observing these days is that all of my tests in the suite starts failing throwing this exception

Additional information: A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:5557/wd/hub/session/c775e68e-c842-41b3-a1a6-44a88ef4c210/element. The status of the exception was KeepAliveFailure, and the message was: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.

I am not able to figure out what is the issue and what I need to do to resolve this issue. I am quite sure this is not to do with the coding.

The issue mainly occurs when I try clicking on a button or trying to enter some text in the input box.

Could any one please point me in the right direction as what I need to resolve this issue

Thanks

Upvotes: 5

Views: 2748

Answers (1)

chris-crush-code
chris-crush-code

Reputation: 1149

This is old but thought I'd throw an answer here for anybody stumbling upon the same issue. Ran into this earlier today. I was able to get it to work by reducing the polling interval of the wait:

WebDriverWait myWait = new WebDriverWait(driver, TimeSpan.FromMinutes(5));
myWait.PollingInterval = TimeSpan.FromMilliseconds(500); //I reduced this from checking every 5 second to checking every half second and it started working.
bool waitOnUser = myWait.Until(t =>
            { ...});

Upvotes: 2

Related Questions