Install libgconf2 if Python Selenium ChromeDriver Fails to Start with Error 127

Django Linux
2017-09-11 17:35 (7 years ago) ytyng

Ubuntu 14.04

When trying to launch Selenium ChromeDriver with Python:

$ xvfb-run ipython
In [3]: from selenium.webdriver import Chrome

In [4]: d = Chrome()
---------------------------------------------------------------------------
WebDriverException                            Traceback (most recent call last)
<ipython-input-4-0dc1ed148f2d> in <module>()
----> 1 d = Chrome()

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.pyc in __init__(self, executable_path, port, chrome_options, service_args, desired_capabilities, service_log_path)
    60                  service_args=service_args,
    61                  log_path=service_log_path)
---> 62                  self.service.start()
    63 
    64                  try:

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.pyc in start(self)
    94                  count = 0
    95                  while True:
---> 96                      self.assert_process_still_running()
    97                      if self.is_connectable():
    98                          break

/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.pyc in assert_process_still_running(self)
    107                      raise WebDriverException(
    108                          'Service %s unexpectedly exited. Status code was: %s'
--> 109                          % (self.path, return_code)
    110                      )
    111 

WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127

First, try launching chromedriver on its own:

$ chromedriver
chromedriver: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory

→ Launch failed

Install libgconf2:

$ apt search libgconf

...

$ sudo apt install libgconf2-4

Try launching chromedriver again:

$ chromedriver
Starting ChromeDriver 2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5) on port 9515
Only local connections are allowed.

Launched successfully!

Run from Python again:

$ xvfb-run ipython
In [1]: from selenium.webdriver import Chrome

In [2]: d = Chrome()

In [3]:

Launched successfully!

Current rating: 4.1
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Comments

Archive

2025
2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011