How to fix "usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed" error in Linux? [duplicate]
Asked Answered
B

1

3

I'm trying to setup a jenkins server to host my automation framework with Selenium-webdriver(3.142.0) and ruby(2.3.7) on Amazon Linux. If I try to invoke a chromedriver using my script, it says,

"Selenium::WebDriver::Error::UnknownError: unknown error: Chrome failed to start: exited abnormally (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=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 4.14.104-95.84.amzn2.x86_64 x86_64)".

I've placed my chromedriver under '/var/lib/jenkins/driver/chromedriver' and set the PATH for the same in .bashrc and also created a symlink for the same to '/usr/bin/google-chrome'. Below are the details of the machine that I'm using:

    NAME="Amazon Linux"
    VERSION="2"
    ID="amzn"
    ID_LIKE="centos rhel fedora"
    VERSION_ID="2"
    PRETTY_NAME="Amazon Linux 2"
    ANSI_COLOR="0;33"
    CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
    HOME_URL="https://amazonlinux.com/"```

require 'selenium-webdriver'
options = Selenium::WebDriver::Chrome::Options.new
options.add_argument("--disable-dev-shm-usage");
options.add_argument('--no-sandbox')
driver = Selenium::WebDriver.for :chrome, options: options



>Expected result: Browser should be invoked.
>Actual result: 
Exits with the error "The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed."
Bary answered 26/4, 2019 at 6:33 Comment(1)
Edit - Issue was because of two reasons. 1) I wasn't trying with headless option and 2) Chrome binary's version was mismatching with chromedriver's. Resolved both and the scripts worked well after then.Bary
F
1

Chrome is not installed on default location. ChromeDriver check for Chrome is installed in the default location /usr/bin/google-chrome for linux system. If you are using a Chrome in a non-standard location then you need to override Chrome binary location.

caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"binary" => "Actual Path"})
Franzen answered 26/4, 2019 at 6:49 Comment(2)
Just navigate to /usr/bin/ and check if google-chrome is there or not. If not then you need to set chrome binary path in code where your actual chrome is installed. I am just stating that chrome driver will look for /usr/bin/google-chrome path for initiating chrome, except you have not added set for binary.Franzen
I could see google-chrome-stable being installed under /usr/bin, but my script still couldn't able to invoke the chromedriver which says the same error mentioned above.Bary

© 2022 - 2024 — McMap. All rights reserved.