Selenium - Exception - Connection getting closed

ぃ、小莉子 提交于 2021-01-27 07:07:07

问题


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


回答1:


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 =>
            { ...});


来源:https://stackoverflow.com/questions/48088350/selenium-exception-connection-getting-closed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!