Selenium出现“UnreachableBrowserException /地址已经在使用”发生在一台电脑上 [英] Selenium abotring with "UnreachableBrowserException/Address already in use" occurring on one computer

查看:248
本文介绍了Selenium出现“UnreachableBrowserException /地址已经在使用”发生在一台电脑上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个java webdriver驱动的硒执行,在列表上循环输入不同的信息到一个文本框,并使用FirefoxDriver发送它。

I have a java webdriver driven selenium execution which does a loop over a list to enter different infomation into a textbox and sending it using the FirefoxDriver.

在一台计算机,在第10次或第11次迭代之后,重复性很好,调用 findElement(By.id(mi4))会产生 UnreachableBrowserException

On one computer, quite reproducible, after the 10th or 11th iteration, the call of findElement(By.id("mi4")) raises an UnreachableBrowserException.

Jun 29, 2012 1:52:02 PM org.apache.http.impl.client.DefaultRequestDirector tryConnect
Information: I/O exception (java.net.BindException) caught when connecting to the target host: Address already in use: connect
Jun 29, 2012 1:52:02 PM org.apache.http.impl.client.DefaultRequestDirector tryConnect
Information: Retrying connect
Jun 29, 2012 1:52:02 PM org.apache.http.impl.client.DefaultRequestDirector tryConnect
Information: I/O exception (java.net.BindException) caught when connecting to the target host: Address already in use: connect
...
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '2.24.1', revision: '17205', time: '2012-06-19 15:28:49'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.7.0_04'
Driver info: driver.version: RemoteWebDriver
   at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:467)
   at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:242)
Caused by: java.net.BindException: Address already in use: connect
   at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
   at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
   at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
   at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:337)
   at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:297)
   at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:136)

没有第三方程序侦听任何端口。但是,我使用了两个FirefoxDriver实例,意思是两个并行打开的Firefox实例/ Windows,在Win7机器上没有任何问题,所描述的问题发生在Windows XP机器上。

There is no third party program listening on any ports. However, I use two instances of FirefoxDriver, meaning two Firefox instances/Windows opened in parallel, which works without any problem on a Win7 machine, the problem described occurs on a Windows XP machine.

我用的是Firefox 2.13.2.2.1。

I use Firefox 13 with selenium 2.24.1.

推荐答案

这听起来像你正在用完临时端口你正在反复迭代。在Windows XP中,临时TCP端口的默认最大数量是5000。请尝试按照Microsoft知识库文章此处中的分辨率提高限制。重新启动机器。这个解决方案已经为我工作了。

It sounds like you are running out of ephemeral ports since you are iterating over and over. The default maximum number of ephemeral TCP ports is 5000 in windows XP. Try increasing the limit as per the resolution in Microsoft KB article here. Restart the machine. This solution has worked for me.

这篇关于Selenium出现“UnreachableBrowserException /地址已经在使用”发生在一台电脑上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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