7

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.

root
  • 151
  • 2
  • 11
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. Also see [Where do I post questions about Dev Ops?](http://meta.stackexchange.com/q/134306) – jww Jan 14 '17 at 08:01
  • 1
    I'm late to this party, but this is definitely not dev ops. This is a problem I'm currently encountering when trying to use selenium for chrome extension development on a VM that had no screen. [This post](http://stackoverflow.com/questions/26070834/how-to-fix-selenium-webdriverexception-the-browser-appears-to-have-exited-befor/37760053) is the closest I've found to an answer, but I'm still having this problem. – firechant Apr 22 '17 at 22:31
  • hey @firechant, after much experimenting, i eventually got the found a workaround by swapping to Firefox on a Ubuntu EC2 instance. not an ideal solution, but it got the job done for me... 1. basic EC2 setup, 2. download pip package manager, 3. apt-get xvfb, 4. install Firefox 50.1.0 and geckodriver 0.11.1 – root Apr 24 '17 at 13:38

2 Answers2

4

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!

bubthegreat
  • 301
  • 1
  • 9
  • 1
    I was using Ubuntu 16.04 at the time, but got to this answer after an exhaustive search - it may not be super helpful if you're on a debian build, but if you're getting an error, hit me up with your debian version and I'll see if I can help – bubthegreat May 08 '18 at 06:16
  • I did what you suggested @bubthegreat and it seems to have set everything up right, but I'm getting this error now: `packages/selenium/webdriver/common/service.py", line 88, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions.` I'm on 16.04 and have been cranking on this thing for hours. Any direction would be awesome. It's an EC2 Ubuntu instance that I'm using. – Bryan Heckler Jun 01 '18 at 04:12
  • @bubthegreat I solved a permissions problem by setting the chromedriver to be executable with going to the directory the driver was in and using this command `chmod a+x chromedriver`, but now I'm stuck at a `chromedriver unexpectedly exited. Status code was: 12`. I'm all out of tinker juice. :\ – Bryan Heckler Jun 01 '18 at 05:03
  • Haven't been able to reproduce, but maybe try https://www.reddit.com/r/learnpython/comments/81ethp/chromiumchromedriver_missing_library_libgfx_on/ – bubthegreat Jun 22 '18 at 21:40
1

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

Community
  • 1
  • 1
Lokendra Singh Rawat
  • 1,889
  • 1
  • 9
  • 8