The application I'm testing needs to be tied to Chrome 11.x so i
cannot use the latest Chrome WebDriver. I tried to use the recommended
method of using the Selenium backed WebDriver. However, I get an
exception when starting the browser. The same code works well with
Firefox.
Unable to use Selenium Backed Webdriver with Chrome
Build Server: selenium-server-standalone-2.0.0.jar
Build Client: selenium-java-2.0rc3.jar
OS: Win7
Browser: Chrome 12.x
Steps:
1. Launch server
2. Run following snippet
{{{
Capabilities capabilities = DesiredCapabilities.chrome();
CommandExecutor executor = new SeleneseCommandExecutor(new URL("http://
localhost:4444/"), new URL("
http://www.google.com/"), capabilities);
WebDriver driver = new RemoteWebDriver(executor, capabilities);
}}}
Result:
On client gets:
org.openqa.selenium.WebDriverException: Could not start Selenium
session: Failed to start new browser session: Error while launching
browser
On server gets:
15:12:57.961 INFO [22]
org.openqa.selenium.server.SeleniumDriverResourceHandler - Command
request: getNewBrowserSession[*googlechrome /Applications/Google
Chrome.app/Contents/MacOS/Google Chrome,
http://www.google.com/, ,
platform=ANY;browserName=chrome;version=] on session null
15:12:57.964 INFO [22]
org.openqa.selenium.server.BrowserSessionFactory - creating new remote
session
15:12:57.968 DEBUG [22]
org.openqa.selenium.server.browserlaunchers.BrowserLauncherFactory -
Requested browser string '*googlechrome /Applications/Google
Chrome.app/Contents/MacOS/Google Chrome' matches *googlechrome
15:12:57.968 DEBUG [22]
org.openqa.selenium.browserlaunchers.locators.BrowserLocator -
Checking whether Google Chrome launcher at :'\Applications\Google
Chrome.app\Contents\MacOS\Google Chrome' is valid...
15:12:57.968 INFO [22]
org.openqa.selenium.server.BrowserSessionFactory - Allocated session
3bac0e3775244973b9aef70e927961d9 for
http://www.google.com/,
launching...
15:12:57.969 INFO [22]
org.openqa.selenium.server.browserlaunchers.GoogleChromeLauncher -
Launching Google Chrome...
15:12:57.997 ERROR [22]
org.openqa.selenium.server.BrowserSessionFactory - Failed to start new
browser session, shutdown browser and clear all session data
java.lang.NullPointerException
at
org.openqa.selenium.server.browserlaunchers.GoogleChromeLauncher.createCommandArray(GoogleChromeLauncher.java:
166)
at
org.openqa.selenium.server.browserlaunchers.GoogleChromeLauncher.launch(GoogleChromeLauncher.java:
77)
at
org.openqa.selenium.server.browserlaunchers.AbstractBrowserLauncher.launchRemoteSession(AbstractBrowserLauncher.java:
37)
at
org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:
375)
at
org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:
125)
at
org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:
87)
at
org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:
785)
at
org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:
422)
at
org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:
393)
at
org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:
146)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:
820)
at
org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:
986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:
837)
at
org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:
243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:
357)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:
534)
15:12:58.019 INFO [22]
org.openqa.selenium.server.browserlaunchers.GoogleChromeLauncher -
Killing Google Chrome...
15:12:58.022 DEBUG [22]
org.openqa.selenium.server.FrameGroupCommandQueueSet - clearing queue
set
15:12:58.022 INFO [22]
org.openqa.selenium.server.SeleniumDriverResourceHandler - Got result:
Failed to start new browser session: Error while launching browser on
session null
15:12:58.023 DEBUG [22] org.openqa.jetty.http.HttpContext - Handled by
org.openqa.selenium.server.SeleniumDriverResourceHandler in
HttpContext[/selenium-server,/selenium-server]
15:12:58.025 DEBUG [22] org.openqa.jetty.http.HttpConnection -
RESPONSE:
HTTP/1.1 200 OK
Date: Tue, 12 Jul 2011 22:12:57 GMT
Server: Jetty/5.1.x (Windows 7/6.1 amd64 java/1.6.0_24
Cache-Control: no-cache
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Content-Length: 66