硒-异常-连接即将关闭 [英] Selenium - Exception - Connection getting closed

查看:40
本文介绍了硒-异常-连接即将关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用通过.NET/Microsoft Technology堆栈运行的最新Selenium WebDriver.

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

其他信息:引发了带有空响应的异常,该异常将HTTP请求发送到URL为

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

谢谢

推荐答案

这很老,但我想为任何遇到相同问题的人在这里抛出一个答案.今天早些时候碰到这个.我能够通过减少等待的轮询间隔来使其工作:

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

这篇关于硒-异常-连接即将关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆