Selenium在一台计算机上发生了“UnreachableBrowserException / Address has in use”
我有一个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和selenium 2.24.1。
听起来你正在用尽短暂的端口,因为你一遍又一遍地迭代。 Windows XP中默认的最大临时TCP端口数为5000。 尝试按照此处 Microsoft KB文章中的分辨率增加限制。 重启机器。 这个解决方案对我有用。
- 在PATH中找不到firefox二进制文件。 确保安装了firefox。 操作系统似乎是:VISTA
- Selenium:如何在不调用driver.quit()的情况下停止影响PC内存的geckodriver进程?
- 在selenium中绕过capcha
- java运行时6与socks v5代理 – 可能吗?
- 在Firefox中自动下载pdf文件
- Firefox错误:使用Java启动Selenium 3.0.1驱动程序时“您的连接不安全”
- 使用Selenium WebDriver未检测到Firefox警报框
- 如何通过Java中的Firefox配置文件下载CSV文件
- 使用Selenium在FireFox中设置首选项时出现mime类型问题