5

I am fairly new to Centos7 and trying to develop a solution for browser automation in the below environment:

OS: Centos7 Ruby: 2.6 Watir Browser:Google Chrome 72.0.3626.109 Driver: ChromeDriver 2.46.628388

My script:

require 'watir'

# Initialize the browser with the driver path
site="https://google.com"
browser = Watir::Browser.new :chrome
browser.goto site

Getting error:

`assert_ok': unknown error: Chrome failed to start: exited abnormally (Selenium::WebDriver::Error::UnknownError)
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 3.10.0-957.5.1.el7.x86_64 x86_64)

I found multiple solutions on net that are recommending to modify chrome options like:

chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')

But I don't know where to set these. The nearest I was able to reach is the answers provided here: How do I pass options to the Selenium Chrome driver using Python?

Can anyone please help me to resolve it in a step-by-step manner?

Nishant Kansal
  • 501
  • 1
  • 10
  • 23
  • http://chromedriver.chromium.org/capabilities will give you background on chrome capabilities. Check out http://watir.com/watir-6-6/ to see how to use them in `watir`. Try `Watir::Browser.new :chrome, :args => [ "--no-sandbox" ]` when instantiating your browser... – orde Feb 19 '19 at 18:07
  • I tried with passing the arguments as explained by you. However, error is still the same: /usr/local/rvm/gems/ruby-2.6.0/gems/selenium-webdriver-3.141.0/lib/selenium/webdriver/remote/response.rb:69:in `assert_ok': unknown error: Chrome failed to start: exited abnormally (Selenium::WebDriver::Error::UnknownError) (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) – Nishant Kansal Feb 20 '19 at 04:04
  • Hmmm...might want to try latest chrome + chromedriver. Or check the chromedriver log: http://chromedriver.chromium.org/logging. Good luck. – orde Feb 20 '19 at 21:45

1 Answers1

1

Also faced similar issue but with npm and protractor configuration but I guess the solution would be similar. You have to install chrome browser in your linux system.

The chromedriver is just a wrapper written to use the chromebrowser for running the test cases.

Also if google-chrome is installed you might want to check the path were it is installed in linux based operating system the path expected is under /usr/bin/google-chrome. This file is generally a link to the actual binary of the chrome.

Hope so this helps

error404
  • 2,684
  • 2
  • 13
  • 21