1

I'm trying to run a ruby file which will start chrome driver using selenium webdriver. I have selenium standalone server 2.35.0. and chromedriver executable installed. I'm starting the server by running,

java -jar ./selenium-server-standalone-2.35.0.jar -Dwebdriver.chrome.bin=/usr/bin/google-chrome -Dwebdriver.chrome.driver=/home/./chromedriver &

Two sessions are starting and the chrome driver fails to start.

05:07:34.328 INFO - Executing: [new session: {platform=ANY, javascriptEnabled=tr
ue, cssSelectorsEnabled=true, browserName=chrome, nativeEvents=false, rotatable=
false, takesScreenshot=false, version=, chrome.switches=[--ignore-certificate-er
rors]}] at URL: /session)
05:07:34.329 INFO - Creating a new session for Capabilities [{platform=ANY, cssS
electorsEnabled=true, javascriptEnabled=true, browserName=chrome, nativeEvents=f
alse, rotatable=false, takesScreenshot=false, chrome.switches=[--ignore-certific
ate-errors], version=}]
Starting ChromeDriver (v2.2) on port 9143
05:07:54.887 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException:
 java.lang.reflect.InvocationTargetException
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-38-virtual',
 java.version: '1.7.0_25'
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(DefaultSessi
on.java:176)
        at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSessio
n.java:112)
        at org.openqa.selenium.remote.server.DefaultSession.createSession(Defaul
tSession.java:89)
        at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(De
faultDriverSessions.java:89)
        at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSessio
n.java:63)
        at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConf
ig.java:205)
        at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(
JsonHttpRemoteConfig.java:192)
        at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverS
ervlet.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.jav
a:428)
        at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler
.java:677)
        at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.j
ava: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:9
86)
        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.InvocationT
argetException
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-38-virtual',
 java.version: '1.7.0_25'
Driver info: driver.version: unknown
        at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructo
r(DefaultDriverFactory.java:72)
        at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(De
faultDriverFactory.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:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:615)
        at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at org.openqa.selenium.remote.server.DefaultDriverFactory.callConstructo
r(DefaultDriverFactory.java:62)
        ... 9 more
Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed
to start: exited abnormally
  (Driver info: chromedriver=2.2,platform=Linux 3.2.0-38-virtual x86_64) (WARNIN
G: The server did not provide any stacktrace information)
Command duration or timeout: 20.56 seconds
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-38-virtual',
 java.version: '1.7.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.
java:191)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHa
ndler.java:145)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.ja
va:554)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriv
er.java:216)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.jav
a:111)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.jav
a:115)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:150)

        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:129)

        ... 14 more
05:07:54.889 WARN - Exception: unknown error: Chrome failed to start: exited abn
ormally
  (Driver info: chromedriver=2.2,platform=Linux 3.2.0-38-virtual x86_64) (WARNIN
G: The server did not provide any stacktrace information)
Command duration or timeout: 20.56 seconds
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-38-virtual',
 java.version: '1.7.0_25'
Driver info: org.openqa.selenium.chrome.ChromeDriver

An error occurred in an after hook
  NoMethodError: undefined method `quit' for nil:NilClass
  occurred at /home/deploy/deployment/ih2/spec/monitoring_script/NineMonitoring.
rb:24:in `block (2 levels) in <top (required)>'

F

Failures:

  1) MonitoringScript test_script
     Failure/Error: @driver = Selenium::WebDriver.for( :remote, :url => 'http://
localhost:4444/wd/hub', :desired_capabilities => @caps )
     Selenium::WebDriver::Error::UnknownError:
       unknown error: Chrome failed to start: exited abnormally
         (Driver info: chromedriver=2.2,platform=Linux 3.2.0-38-virtual x86_64)
(WARNING: The server did not provide any stacktrace information)
       Command duration or timeout: 20.56 seconds
       Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:
42:01'
       System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-38-vi
rtual', java.version: '1.7.0_25'
       Driver info: org.openqa.selenium.chrome.ChromeDriver (org.openqa.selenium
.WebDriverException)
     # [remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstruct
orAccessorImpl.java):-2:in `newInstance0'
     # [remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstruct
orAccessorImpl.java):57:in `newInstance'
     # [remote server] sun.reflect.DelegatingConstructorAccessorImpl(DelegatingC
onstructorAccessorImpl.java):45:in `newInstance'
     # [remote server] java.lang.reflect.Constructor(Constructor.java):526:in `n
ewInstance'
     # [remote server] org.openqa.selenium.remote.ErrorHandler(ErrorHandler.java
):191:in `createThrowable'
     # [remote server] org.openqa.selenium.remote.ErrorHandler(ErrorHandler.java
):145:in `throwIfResponseFailed'
     # [remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDrive
r.java):554:in `execute'
     # [remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDrive
r.java):216:in `startSession'
     # [remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDrive
r.java):111:in `<init>'
     # [remote server] org.openqa.selenium.remote.RemoteWebDriver(RemoteWebDrive
r.java):115:in `<init>'
     # [remote server] org.openqa.selenium.chrome.ChromeDriver(ChromeDriver.java
):150:in `<init>'
     # [remote server] org.openqa.selenium.chrome.ChromeDriver(ChromeDriver.java
):129:in `<init>'
     # [remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstruct
orAccessorImpl.java):-2:in `newInstance0'
     # [remote server] sun.reflect.NativeConstructorAccessorImpl(NativeConstruct
orAccessorImpl.java):57:in `newInstance'
     # [remote server] sun.reflect.DelegatingConstructorAccessorImpl(DelegatingC
onstructorAccessorImpl.java):45:in `newInstance'
     # [remote server] java.lang.reflect.Constructor(Constructor.java):526:in `n
ewInstance'
     # [remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(De
faultDriverFactory.java):62:in `callConstructor'
     # [remote server] org.openqa.selenium.remote.server.DefaultDriverFactory(De
faultDriverFactory.java):56:in `newInstance'
     # [remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserC
reator(DefaultSession.java):215:in `call'
     # [remote server] org.openqa.selenium.remote.server.DefaultSession$BrowserC
reator(DefaultSession.java):1:in `call'
     # [remote server] java.util.concurrent.FutureTask$Sync(FutureTask.java):334
:in `innerRun'
     # [remote server] java.util.concurrent.FutureTask(FutureTask.java):166:in `
run'
     # [remote server] org.openqa.selenium.remote.server.DefaultSession$1(Defaul
tSession.java):169:in `run'
     # [remote server] java.util.concurrent.ThreadPoolExecutor(ThreadPoolExecuto
r.java):1145:in `runWorker'
     # [remote server] java.util.concurrent.ThreadPoolExecutor$Worker(ThreadPool
Executor.java):615:in `run'
     # [remote server] java.lang.Thread(Thread.java):724:in `run'
     # ./NineMonitoring.rb:11:in `block (2 levels) in <top (required)>'

Finished in 20.75 seconds
1 example, 1 failure

Failed examples:

rspec ./filename.rb:28 # filename test_script

This comes after I run the file using

bundle exec rspec filename.rb

I'm new to this and not able to figure out what is going wrong. And also I'm trying to run it headless, so I have Xvfb running. Can someone please help in pointing out the mistake I make and get the chromedriver started?

UPDATE:

After the suggestions, I had updated the ChromeDriver and get the following error:

10:19:44.378 INFO - Executing: [new session: {platform=ANY, javascriptEnabled=tr
ue, cssSelectorsEnabled=true, browserName=chrome, nativeEvents=false, rotatable=
false, takesScreenshot=false, version=, chrome.switches=[--ignore-certificate-er
rors]}] at URL: /session)
10:19:44.417 INFO - Creating a new session for Capabilities [{platform=ANY, cssS
electorsEnabled=true, javascriptEnabled=true, browserName=chrome, nativeEvents=f
alse, rotatable=false, takesScreenshot=false, chrome.switches=[--ignore-certific
ate-errors], version=}]
Starting ChromeDriver (v2.9.248304) on port 21908
[0.723][WARNING]: PAC support disabled because there is no system implementation

An error occurred in an after hook
  NoMethodError: undefined method `quit' for nil:NilClass
  occurred at /home/deploy/deployment/ih2/spec/monitoring_script/NineMonitoring.
rb:24:in `block (2 levels) in <top (required)>'

While running the file:

Failures:

  1) MonitoringScript test_script
     Failure/Error: @driver = Selenium::WebDriver.for( :remote, :url => 'http://
localhost:4444/wd/hub', :desired_capabilities => @caps )
     Timeout::Error:
       Timeout::Error
     # ./testfile.rb:11:in `block (2 levels) in <top (required)>'

Finished in 1 minute 0.19031 seconds
1 example, 1 failure

Can anyone please help me in figuring out what is going wrong?

Saran
  • 71
  • 1
  • 8
  • First thing would be to update both Selenium and ChromeDriver: http://docs.seleniumhq.org/download/ and http://chromedriver.storage.googleapis.com/index.html ...since you are heavily out of date for both. – Arran Feb 22 '14 at 13:17
  • Thanks Arran. But while experimenting and exploring selenium, I did have the latest version of selenium standalone server and chromedriver. But it didn't seem to get along. Previously, I successfully executed this file after downgrading to selenium standalone server 2.35. Now I have figured out the problem. I have changed my java 1.6.0_27 to java 1.7 version. Selenium and chromedriver doesn't seem to like this combination. So again I tried using the latest version of selenium and chromedriver, but doesn't work. Now I'm wondering how to proceed!!!! – Saran Feb 24 '14 at 09:28
  • What versions of **Chrome** and **ChromeDriver** and **Selenium** and **Java** are you *now* running? – Arran Feb 24 '14 at 09:30
  • Selenium-server-standalone-2.37.0.jar ; Google Chrome 33.0.1750.117; chromedriver_linux64_2.2; Java version "1.7.0_25" OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode) – Saran Feb 24 '14 at 09:42
  • In which case you've confirmed what I previously said. ChromeDriver version **2.2** is out of date (5 months old) and will have **no chance at all** in supporting Chrome v33. http://chromedriver.storage.googleapis.com/index.html?path=2.9/ .... (note this is not necessarily the cause, but even if it isn't, nothing is going to work unless you update it anyway) – Arran Feb 24 '14 at 09:54
  • Thanks for the reply Arran. I did update the ChromeDriver version and extracted it. After running the file - I still get into error. :( – Saran Feb 24 '14 at 10:28
  • I have updated my question with the failure message I'm getting after the above changes. – Saran Feb 24 '14 at 10:39
  • The value is `@caps` is what? – Arran Feb 24 '14 at 10:50
  • Part of my script is below: `before(:each) do @caps = Selenium::WebDriver::Remote::Capabilities.chrome @caps['chrome.switches'] = %w[--ignore-certificate-errors] @driver = Selenium::WebDriver.for( :remote, :url => 'http://localhost:4444/wd/hub', :desired_capabilities => @caps ) @driver.manage.timeouts.implicit_wait = 30 @verification_errors = [] end after(:each) do @driver.quit @verification_errors.should == [] end` – Saran Feb 24 '14 at 11:05

1 Answers1

2

Using Java 1.6 did the trick.

After trying Selenium-server-standalone-2.37.0.jar ; Google Chrome 33.0.1750.117; chromedriver_linux64_2.2; Java version "1.7", found that java version didn't go along with the others. And hence solved my problem.

Saran
  • 71
  • 1
  • 8