5

Recently, especially with multiple tasks and processes running on the same pc, selenium webdriver 2 is giving many unreachable browser exceptions which are always with a java socket exception:

 Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException:                         Could not start a new session. Possible causes are invalid address of the remote server or     browser start-up failure.
   Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54'
  System info: os.name: 'Windows Vista', os.arch: 'x86', os.version: '6.0',       java.version: '1.7.0_05'
   Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:493)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:182)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:185)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:178)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:174)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:92)

    Caused by: java.net.SocketException: Permission denied: connect
at java.net.DualStackPlainSocketImpl.connect0(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.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:150)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:575)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:319)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:297)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:136)
at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:357)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:472)
... 7 more

Why does this happen so often? Is selenim 2.25 incompatible with firefox 14?

3
  • Your browser might have died. You should capture screen shots at test failures. That will give a clear picture of whats happening and take out second guessing. Commented Jan 21, 2013 at 8:00
  • @StéphanePiette ya. DISABLE FIREFOX UPDATES WHEN USING SELENIUM!!!! selenium takes time to update its version for the newest firefox Commented May 7, 2013 at 4:50
  • 1. Do not share driver across threads, 2. Close the driver instance properly... Commented May 8, 2016 at 19:16

4 Answers 4

3

I found myself struggling with this issue for months, i really tried almost everything but still got random "UnreachableBrowserException" errors.

This is the only working solution for me.

System.setProperty("java.net.preferIPv4Stack" , "true");
Sign up to request clarification or add additional context in comments.

Comments

1

I also had the same issue with Selenium Web Driver. Specially when I run a long test scripts without restarting the web driver. Then I moved to a new machine with much performance and then I could avoid it nearly 90 %.

I assumed this happened because of lack of memory and I upgraded my RAM up to 4GB in my new machine.

That solved my issue and now everything is OK.

Note : Please check whether you close the driver correctly after every test run.It also may lead to kill the driver due to memory leak.

Comments

0

This is because of 2 reasons

  • session not getting killed, try to kill the session and run the test again.

  • selenium web driver cannot find the FF browser to start it.

Also Check all your client drivers and selenium-server.jar are placed on the libararies.

Could you paste the configuration code on starting FF?

Comments

0

I have faced the issue couple of times. There could be various reasons for the same.

  1. Your browser instance is not closed properly. So checkout from your task manager whether it is killing the driver when you are calling driver.close() method. I have observed it for mostly chrome and IE. For Firefox it will automatically closes the instance.

  2. FF and Webdriver version should be compatible to each other. Change your Webdriver jars and try it.

  3. There may be unwanted jar present in your project. Xalan.jar is what gave me problem once. Remove it and see.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.