当前位置: 首页 > 面试题库 >

一台计算机上出现selenium素“ UnreachableBrowserException /地址已在使用中”

方楷
2023-03-14
问题内容

我有一个Java WebDriver驱动的Selenium执行,它在列表上循环以在文本框中输入其他信息并使用FirefoxDriver发送它。

在第10次或第11次迭代后,在一台非常可重现的计算机上,调用
findElement(By.id("mi4"))会引发一个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机器上会出现上述问题。

我将Firefox 13与selenium2.24.1一起使用。


问题答案:

听起来好像您用完了临时端口,因为您要一遍又一遍地进行迭代。在Windows
XP中,临时TCP端口的默认最大数量为5000。尝试按照此处
Microsoft KB文章中的分辨率增加限制。重新启动机器。这个解决方案对我有用。



 类似资料:
  • 问题内容: 我可以用 获取mac地址,但是如果我在离线计算机上使用此代码,它将无法正常工作。 那么,如何获得Mac地址? 问题答案: 在Java 6+中,你可以使用。 请记住,计算机不能有网卡,尤其是嵌入式或虚拟的网卡。它也可以有多个。你可以使用来获取所有网卡的列表。

  • 问题内容: 我想检查请求url的状态码但获取代码 这是我的代码 堆栈跟踪 问题答案: 我认为,此问题是由Java尝试使用IPV6地址引起的,原因是您的操作系统不支持IPV6地址,或者您的操作系统没有正确设置IPV6地址来处理它。 您可以强制Java使用具有以下属性的IPV4地址: -Djava.net.preferIPv4Stack = true

  • 我的Java应用程序中出现了以下错误: ERRORo.a.catalina.core.标准服务-未能启动连接器[连接器[HTTP/1.1-9004]]ontext.refresh生命异常:未能启动组件[连接器[HTTP/1.1-9004]]在ontext.java:546生命周期Borg.springframework.boot.context.embedded.(生命周期Base.java:16

  • 试了好几个方法,只好问到这里。所以最近我在我自己的一个网站上工作,这个网站是在我的本地桌面上开发的(使用xampp),但是现在我想从我的笔记本电脑(ubuntu 16.04)在同一个网站上工作(本地),所以我在我的笔记本电脑上安装了xampp(lampp)尝试了以下方法:- 1.)我从桌面(localhost/phpmyadmin)导出了数据库 2。)已从桌面版本复制wordpress/wp内容文

  • 问题内容: 我正在尝试使用启动多个docker容器,但出现以下(部分)错误消息: 按照https://github.com/docker/docker/issues/8714的建议,我尝试了命令 导致 但是,我在这里看不到任何可以杀死的进程ID。任何想法是什么导致此错误? 问题答案: 以下https://unix.stackexchange.com/questions/106561/finding