Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chromedriver error on Linux

After formatting a Redhat server (Amazon-flavored Linux) and reinstalling python, selenium, pyvirtualdisplay, Xvfb, Chrome and Chromedriver, I've encountered an error: selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/chromedriver unexpectedly exited. Status code was: 127

This error occurs upon initializing the browser / driver with: driver = webdriver.Chrome(executable_path="/usr/bin/chromedriver")

I'm using Richard Lloyd's Chrome and Chromedriver 2.9. I believe this issue stems from dependency issues with Chromedriver.

Any help would be greatly appreciated. Been struggling with this for a little while now.

like image 708
root Avatar asked Jan 13 '17 19:01

root


2 Answers

I know it's a bit late, but I got to this searching for the problem - and the problem was that I didn't have chromium installed. I followed this walkthrough by jrg, and was able to get it to open the webdriver perfectly.

The commands I ran, in order, are here:

sudo apt-get install libxss1 libappindicator1 libindicator7 fonts-liberation
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb

After that I was able to create a webdriver just fine with:

driver = webdriver.Chrome(CHROME_DRIVER_PATH)

Hope that helps anyone else getting to this answer for the same reason!

like image 147
bubthegreat Avatar answered Oct 10 '22 11:10

bubthegreat


Well, if it is a dependency problem as you described here, this can help you to understand what's missing?

LD_DEBUG=all path-to-executable/command/driver -args(if any)

Example:

LD_DEBUG=all cat

example output:

LD_DEBUG=all ping google.com

As in this output screenshot it shows what actually needed to ping and in which sequence similarily when CTRL+C issued it shows what's happening to stop that ping.

I posted this screenshot as I can't post the whole output due to char limit, let me know if it doesn't solve your issue.

check this for a complete output http://www.bnikolic.co.uk/blog/linux-ld-debug.html

like image 23
Lokendra Singh Rawat Avatar answered Oct 10 '22 10:10

Lokendra Singh Rawat