运行Selenium测试时随机UnreachableBrowserException异常 [英] Random UnreachableBrowserException when running Selenium tests

查看:1079
本文介绍了运行Selenium测试时随机UnreachableBrowserException异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现,当运行我的硒测试时,我在控制台中收到错误.....但是这些错误在每次运行时都不会出现。请看下面的输出副本:

 启动InternetExplorerDriver服务器(64位)
2.44.0.0
侦听端口39496
线程main中的异常org.openqa.selenium.remote.UnreachableBrowserException:与远程浏览器通信时出错,可能已经死了
构建信息:version:'2.43 .1',修订:'5163bce',时间:'2014-09-10 16:27:58'
系统信息:主机:'MBD0150',ip:'192.168.55.49',os.name:' Windows 8.1',os.arch:'amd64',os.version:'6.3',java.version:'1.8.0_25'
驱动程序信息:driver.version:RemoteWebDriver
在org.openqa。在远程Web浏RemoteWebElement.click(RemoteWebElement.java:79)
在genericControls.contractFunctions.matchRequestTableContractSelectFunction(contractFunctions.java:150)
a t Reports.collections.earlySettlementWorkflowFunction(collections.java:94)
在Reports.programMain.main(programMain.java:44)
导致:org.openqa.selenium.WebDriverException:java.net.SocketException :Permission denied:connect
Build info:version:'2.43.1',revision:'5163bce',time:'2014-09-10 16:27:58'
系统信息:host:' MBD0150',ip:'192.168.55.49',os.name:'Windows 8.1',os.arch:'amd64',os.version:'6.3',java.version:'1.8.0_25'
驱动info:driver.version:RemoteWebDriver
在org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:75)
在org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver .java:572)
... 5更多
引起的:java.net.SocketException:Permission denied:connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
在java.net.AbstractP lainSocketImpl.doConnect(未知源)
在java.net.AbstractPlainSocketImpl.connectToAddress(未知源)
在java.net.AbstractPlainSocketImpl.connect(未知源)
在java.net.PlainSocketImpl。连接(未知源)
在java.net.SocksSocketImpl.connect(未知源)
在java.net.Socket.connect(未知源)
在org.apache.http.conn。 socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:72)
在org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
在org.apache.http.impl。 conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
在org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
在org.apache.http.impl。 execchain.MainClientExec.execute(MainClientExec.java:219)
在org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
在org.apache.http.impl。 execchain.RetryE xec.execute(RetryExec.java:86)
在org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
在org.apache.http.impl.client。 InternalHttpClient.doExecute(InternalHttpClient.java:184)
在org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
在org.apache.http.impl.client。 CloseableHttpClient.execute(CloseableHttpClient.java:57)
在org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:233)
在org.openqa.selenium.remote.HttpCommandExecutor.execute( HttpCommandExecutor.java:184)
在org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:66)
...另外6个*

我做了一些研究,根据我发现,去:
HKEY_LOCAL_MACHINE> SYSTEM>服务> Tcpip>参数



....并创建一个名称为MaxUserPort的REG_DWORD。然后将值设置为'65534'。我选择了这种方法,因为我的印象是问题是由于每次使用Internet Explorer驱动程序运行测试时都会打开一个新的端口。不幸的是,这样做还没有解决这个问题。我没有附加与上述错误相关的代码,因为我不认为它是相关的,因为错误将出现在我以前工作的某些地方的不同点。 >

如果有人可以帮忙,那将是很棒的。

解决方案

过去相同的问题,升级后Service Pack已经解决了。但也建议你看下面。




  • 检查网络设置(防火墙,代理,防病毒软件)到
    找到权限被拒绝:连接的原因

  • 找出它是Windows 7的问题,升级到SP1的问题
    已解决。

  • 看起来当运行Web驱动程序时,它会打开许多TCP端口和
    耗尽可用端口,然后抛出此异常。检查
    Selenium版本如果较旧,然后2.44然后尝试升级到2.44和
    看看会发生什么。

  • 运行以下命令,杀死所有运行的IEDriverServer.exe
    进程,taskkill / F / IM IEDriverServer.exe


I'm finding that, when running my selenium tests, I am getting errors in the console.....but these errors, confusingly don't appear on every run. See below for a copy of the output:

"Started InternetExplorerDriver server (64-bit)
2.44.0.0
Listening on port 39496
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Error       communicating with the remote browser. It may have died.
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:58'
System info: host: 'MBD0150', ip: '192.168.55.49', os.name: 'Windows 8.1', os.arch: 'amd64',     os.version: '6.3', java.version: '1.8.0_25'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:79)
at genericControls.contractFunctions.matchRequestTableContractSelectFunction(contractFunctions.java:150)
at Reports.collections.earlySettlementWorkflowFunctions(collections.java:94)
at Reports.programMain.main(programMain.java:44)
Caused by: org.openqa.selenium.WebDriverException: java.net.SocketException: Permission denied:     connect
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:58'
System info: host: 'MBD0150', ip: '192.168.55.49', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_25'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:75)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
... 5 more
Caused by: java.net.SocketException: Permission denied: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:72)
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:233)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:66)
... 6 more"*

I did a bit of research and, based on what I found, went to: HKEY_LOCAL_MACHINE > SYSTEM > Services > Tcpip > Parameters

....and created a REG_DWORD with a name of 'MaxUserPort'. I then set the value to '65534'. I chose this method as I was under the impression the issue is due to a new port opening each time I run a test using Internet Explorer driver. Unfortunately, doing this has not resolved the issue. I've not attached the code relating to the above error as I don't think it's relevant, in that the error will appear at different points of my test.....in some places where it has worked previously.

If anyone can help, that would be great.

解决方案

I faced the same issue in past after upgrading Service pack it was resolved. But also suggest you to look at the below.

  • Check your network settings (firewall, proxy, antivirus software) to find the cause of "Permission denied: connect"
  • Find out it is windows 7's problem, upgrade to SP1 the problem solved.
  • Seems when running web-driver, it will open many many TCP ports and exhaust the available ports, then throw this exception. Check Selenium Version if older then 2.44 then try upgrading to 2.44 and see what happens.
  • Running the following command, killed all running IEDriverServer.exe processes, taskkill /F /IM IEDriverServer.exe

这篇关于运行Selenium测试时随机UnreachableBrowserException异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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