Exception, Functional Tests, Java, Selenium Errors

org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities [{browserName=safari}]

Problem Statement


Exception in thread "main" org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities [{browserName=safari}]
Command duration or timeout: 198 milliseconds
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:17:32'
System info: host: 'XXXX', ip: '192.168.14.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
 at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
 at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
 at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
 at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
 at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153)
 at remoteDriver.TestFireFoxRemotely.main(TestFireFoxRemotely.java:17)

Caused by: org.openqa.grid.common.exception.GridException: Error forwarding the new session Empty pool of VM for setup Capabilities [{browserName=safari}]
 at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:114)
 at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:83)
 at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:67)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
 at org.seleniumhq.jetty7.servlet.ServletHolder.handle(ServletHolder.java:565)
 at org.seleniumhq.jetty7.servlet.ServletHandler.doHandle(ServletHandler.java:479)
 at org.seleniumhq.jetty7.server.session.SessionHandler.doHandle(SessionHandler.java:225)
 at org.seleniumhq.jetty7.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
 at org.seleniumhq.jetty7.servlet.ServletHandler.doScope(ServletHandler.java:406)
 at org.seleniumhq.jetty7.server.session.SessionHandler.doScope(SessionHandler.java:186)
 at org.seleniumhq.jetty7.server.handler.ContextHandler.doScope(ContextHandler.java:965)
 at org.seleniumhq.jetty7.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
 at org.seleniumhq.jetty7.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
 at org.seleniumhq.jetty7.server.Server.handle(Server.java:349)
 at org.seleniumhq.jetty7.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
 at org.seleniumhq.jetty7.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:47)
 at org.seleniumhq.jetty7.server.AbstractHttpConnection.content(AbstractHttpConnection.java:894)
 at org.seleniumhq.jetty7.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:948)
 at org.seleniumhq.jetty7.http.HttpParser.parseNext(HttpParser.java:857)
 at org.seleniumhq.jetty7.http.HttpParser.parseAvailable(HttpParser.java:235)
 at org.seleniumhq.jetty7.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:66)
 at org.seleniumhq.jetty7.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:254)
 at org.seleniumhq.jetty7.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
 at org.seleniumhq.jetty7.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
 at java.lang.Thread.run(Thread.java:745)


Code used


 public static void main(String [] args){
 DesiredCapabilities capabilities = new DesiredCapabilities();
 capabilities.setBrowserName("safari");
 RemoteWebDriver remoteWD = null;
 try{
 remoteWD = new RemoteWebDriver(new URL("http://127.0.0.1:4444/wd/hub"),capabilities);
 }catch(MalformedURLException e){
 e.printStackTrace();
 }
 remoteWD.get("http://google.com");
 remoteWD.findElement(By.name("q")).sendKeys("Testing");
 }
 }

Selenium grid/server/remote server command


 java -jar selenium-server-standalone.jar -role node -hub http://<ip>/grid/register -browser browserName=firefox -browser browserName=chrome -browser browserName=safari

Root Cause Analysis

The problem was more of the browser. There could be possible below areas which has to be fixed to resolve the above issue:
1. Check if you have Safari browser at the server where you want to send your webdriver execution to. This could be your local machine or remote virtual box,etc
2. Check if you have possible drivers , required for execution.
3. Check if valid-compatible safari browser compatible jar of selenium stand alone jar at the desired machine.

For me its the  first issue, at the remote machine safari browser was not there , I picked the latest safari browser along with the latest selenium standalone jar. And this worked for me.
Advertisements

1 thought on “org.openqa.selenium.WebDriverException: Error forwarding the new session Empty pool of VM for setup Capabilities [{browserName=safari}]”

  1. Hi Sehgal,
    Do you have any idea, about Firefox version support for Eclipse Standard/SDK (Version: Luna Release (4.4.0)).
    When I run basic java with Firefox add ins for opening a google URL in Firefox, it works fine for lower version of Firefox (v27.0) . But for latest version of Firefox (v32), same script just opens a empty Firefox browser. Remaining part of script doesn’t work.

    Note: I’m just beginner in selenium and java. I’ve been following your blog and linked in, your post are very good.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s