Selenium abotring with "UnreachableBrowserException / Address already in use" occurring on the same computer

I have a selenium execution managed by java webdriver that loops through a list to enter various information into a text field and send it using FirefoxDriver.

On one fully reproducible computer, after the 10th or 11th iteration, calling 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) 

There are no third-party programs that listen on any ports. However, I use two FirefoxDriver instances, that is, two Firefox / Windows instances open in parallel, which works without problems on the Win7 machine, the described problem occurs on a computer running Windows XP.

I am using Firefox 13 with selenium 2.24.1.

+7
source share
1 answer

It looks like your ephemeral ports are running out, as you are repeating over and over again. The maximum number of default ephemeral TCP ports is 5000 on Windows XP. Try increasing the limit according to the resolution in the Microsoft KB article here . Reboot the computer. This solution worked for me.

+7
source

All Articles