Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Chrome failing to start when attempting to run Chromedriver under Selenium?

So I had a Chromedriver / Selenium setup working before, but now trying to install everything on a new machine (64Bit Linux) it is giving me problems and not really telling me what is tripping up.

I am using Selenium's stand-alone server version 2.37.0 with nodejs and the latest version of Chromedriver available on Google right now (I also tried Chromedriver 2.0, an earlier version that I had working before, with the same results).

As is shown in the output below, when I try to run a script utilizing the webdriver I get an error that includes: Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally. I am getting no log output from chromedriver, only output from Selenium (with the error) and from Node.js (in its attempt to run the test script).

Can anyone give me an idea of what I am doing wrong here?

EDIT: I forgot to add that after the failure there is a process with Chromedriver running, so that piece is okay, and my Chrome executable is indeed at /etc/bin/google-chrome like Chromedriver wants it to be.

Output:

Once I had selenium up and running I was attempting to run a simple test script with the contents:

var webdriverjs = require("webdriverjs");
var client = webdriverjs.remote({desiredCapabilities:{browserName:"chrome"}}); // to run in chrome
client
.init()
.url("https://github.com/")
.end();

The Node.js console output from running the test script looks like this:

[1;33m=====================================================================================[0m

Selenium 2.0/webdriver protocol bindings implementation with helper commands in nodejs by Camilo Tapia.
For a complete list of commands, visit [1;32mhttp://code.google.com/p/selenium/wiki/JsonWireProtocol[0m. 
Not all commands are implemented yet. visit [1;32mhttps://github.com/Camme/webdriverjs[0m for more info on webdriverjs. 

[1;33m=====================================================================================[0m

[1;30m[21:31:09]: [0m [0;35mCOMMAND [0mPOST      "/wd/hub/session"
[1;30m[21:31:09]: [0m [0;33mDATA         [0m{"desiredCapabilities":{"browserName":"chrome","version":"","javascriptEnabled":true,"platform":"ANY"},"sessionId":null}


[1;30m[21:31:32]: [0m [1;31mERROR   [0mCOULDNT GET A SESSION ID
[1;30m[21:31:32]: [0m Exiting process with 1

Finally, the output from Selenium when it starts up and when attempting to run the script follows. For some reason, I am not getting a chromedriver.log file at all.

java -jar /usr/local/automation/framework/selenium/selenium-server-standalone-2.37.0.jar -Dwebdriver.chrome.driver='/usr/local/automation/framework/selenium/chromedriver' &
[1] 21293
ubuntu@ip-10-0-0-35:/usr/local/automation/framework/selenium$ Nov 15, 2013 9:30:31 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
Setting system property webdriver.chrome.driver to /usr/local/automation/framework/selenium/chromedriver
21:30:32.240 INFO - Java: Oracle Corporation 23.5-b02
21:30:32.241 INFO - OS: Linux 3.2.0-48-virtual amd64
21:30:32.289 INFO - v2.37.0, with Core v2.37.0. Built from revision a7c61cb
21:30:32.586 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver registration is skipped: registration capabilities Capabilities [{platform=MAC, browserName=iPhone, version=}] does not match with current platform: LINUX
21:30:32.626 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: LINUX
21:30:32.774 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver registration is skipped: registration capabilities Capabilities [{platform=MAC, browserName=iPad, version=}] does not match with current platform: LINUX
21:30:32.913 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
21:30:32.918 INFO - Version Jetty/5.1.x
21:30:32.919 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
21:30:32.920 INFO - Started HttpContext[/selenium-server,/selenium-server]
21:30:32.920 INFO - Started HttpContext[/,/]
21:30:32.968 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@3b3d8503
21:30:32.968 INFO - Started HttpContext[/wd,/wd]
21:30:32.974 INFO - Started SocketListener on 0.0.0.0:4444
21:30:32.975 INFO - Started org.openqa.jetty.jetty.Server@3e724328

ubuntu@ip-10-0-0-35:/usr/local/automation/framework/selenium$ 21:31:10.116 INFO - Executing: [new session: {platform=ANY, javascriptEnabled=true, browserName=chrome, version=}] at URL: /session)
21:31:10.164 INFO - Creating a new session for Capabilities [{platform=ANY, javascriptEnabled=true, browserName=chrome, version=}]
Starting ChromeDriver (v2.6.232917) on port 17624
[0.797][WARNING]: PAC support disabled because there is no system implementation
21:31:32.375 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'ip-10-0-0-35', ip: '10.0.0.35', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-48-virtual', java.version: '1.7.0_09'
Driver info: driver.version: unknown
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
    at java.util.concurrent.FutureTask.get(FutureTask.java:111)
    at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:176)
    at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:112)
    at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:89)
    at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:104)
    at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:63)
    at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:205)
    at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(JsonHttpRemoteConfig.java:192)
    at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201)
    at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:167)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:139)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
    at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
    at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:914)
    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)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'ip-10-0-0-35', ip: '10.0.0.35', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-48-virtual', java.version: '1.7.0_09'
Driver info: driver.version: unknown
    at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:72)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:56)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:215)
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.InvocationTargetException
    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:525)
    at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructor(DefaultDriverFactory.java:62)
    ... 9 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.6.232917,platform=Linux 3.2.0-48-virtual x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.99 seconds
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'ip-10-0-0-35', ip: '10.0.0.35', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-48-virtual', java.version: '1.7.0_09'
Driver info: org.openqa.selenium.chrome.ChromeDriver
    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:525)
    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:554)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:111)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:150)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:129)
    ... 14 more
21:31:32.413 WARN - Exception: unknown error: Chrome failed to start: exited abnormally
  (Driver info: chromedriver=2.6.232917,platform=Linux 3.2.0-48-virtual x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 20.99 seconds
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'ip-10-0-0-35', ip: '10.0.0.35', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-48-virtual', java.version: '1.7.0_09'
Driver info: org.openqa.selenium.chrome.ChromeDriver
like image 720
J Ellis Avatar asked Nov 15 '13 22:11

J Ellis


People also ask

Do I need to install Chrome to use ChromeDriver?

Users provided relevant link to confirm that, "YES" a full Chrome installation is needed in addition to the actual chromedriver.

Which Chrome version is compatible with Selenium?

For having a test of Selenium 3 using ChromeBrowser we need an extra app called ChromeDriver. I found this text from GitHub: ChromeDriver is only compatible with Chrome version 12.0. 712.0 or newer.


1 Answers

Ok, after posting all of this I just figured out what I was doing wrong!

The issue was that I was starting selenium from one terminal via SSH and then running the test script from a terminal on the desktop via VNC. Apparently Selenium, WebdriverJS, or Chromedriver does not like this.

It works fine when I start Selenium and run the test script both from the terminal on the desktop.

like image 130
J Ellis Avatar answered Nov 15 '22 03:11

J Ellis