Selenium.common.exceptions.WebDriverException: Message: The chrome service has crashed unexpectedly

I know very similar questions already asked, but even after hours of googling, researching and comparing, I can't figure out what the problem is. My end goal is to do some web scraping with Python using selenium, but at the moment I can't even get the webdriver running. This is the code and error message I have so far:

$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyvirtualdisplay import Display
>>> from selenium import webdriver
>>> 
>>> display = Display(visible=0, size=(1024, 768))
>>> display.start()
<Display cmd_param=['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '1024x768x24', ':1069'] cmd=['Xvfb', '-br', '-nolisten', 'tcp', '-screen', '0', '1024x768x24', ':1069'] oserror=None return_code=None stdout="None" stderr="None" timeout_happened=False>
>>> d = webdriver.Chrome()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
    self.service.start()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 96, in start
    self.assert_process_still_running()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
    % (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1

      

The chrome ribbed version is 2.30 and is located at:

$ ll /usr/local/bin/chromedriver
-rwxr-xr-x 1 stefan stefan 8475456 Jun  7 15:53 /usr/local/bin/chromedriver

      

Since it's in /usr/local/bin

, I don't need to specify the path when instantiating the webdriver as in d = webdriver.Chrome("/path/to/chromedriver")

.

Before I could run the code above, I installed google chrome browser, xvfb, pyvirtualdisplay and selenium. The commands I've used where:

sudo apt-get install libxss1 libappindicator1 libindicator7
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb
sudo apt-get install -f
sudo apt-get install xvfb
wget -N http://chromedriver.storage.googleapis.com/2.30/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/local/bin
sudo pip install pyvirtualdisplay selenium

      

So, I have the latest versions of all software. Any help as to what might solve my problem is greatly appreciated. Thank you so much in advance.

+3


source to share


1 answer


I got the same problem when I started a process with selenium and the PhantomJs driver via nohup (Also mentioned there ) I needed to capture the output in a VM and not depend on an open session.



I started using tmux for this purpose, which doesn't block signals like nohup, and the problem went away.

+1


source







All Articles