user1886649
user1886649

Reputation: 179

Selenium RemoteWebDriver giving UnreachableBrowserException

I am implementing selenium grid and the capability to launch the tests on a remote machine using the RemoteWebDriver.

I am invoking the RemoteWebDriver instance as in:

private static String browserType = "firefox";

public static boolean setup(String browserType) throws Exception,MalformedURLException  {
try {
   logger.debug("Launching the browsersession");
   DesiredCapabilities capability= new DesiredCapabilities();
   capability.setBrowserName(browserType);
   webdriver1 = new RemoteWebDriver(new URL("http://www.ipaddress.com:4444/wd/hub"), capability);
}

webdriver1.get(http://url of the webserver);



}

I started the selenium-standalone as hub with java -jar selenium-server-standalone-2.30.0.jar -role hub

and the node as java -Dwebdriver.chrome.driver=C:/Chrome/chromedri ver.exe -jar selenium-server-standalone-2.30.0.jar -role webdriver -hub http://www.ipaddress.com:4444/grid/register -port 5555 -browser browserName=chrome

Hub was giving an error: INFO: I/O exception (java.net.SocketException) caught when connecting to the tar get host: Permission denied: connect

When I run the tests from Eclipse, there is an exception: 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.

Has anyone encountered this error? Appreciate any suggestions

Upvotes: 2

Views: 3170

Answers (1)

niharika_neo
niharika_neo

Reputation: 8531

Just setting browsername doesn't suffice. You need to set the browser that you need to use. for eg.

DesiredCapabilities capability = DesiredCapabilities.firefox();

Browsername would just help shortlist the node the test should go to.

Please refer here to get started.

Upvotes: 0

Related Questions