Running selenium in c9

2019-05-07 08:31发布

问题:

I am trying to run a python code that uses selenium module. This code ran perfectly with the use of a chromedriver in my PC. I am trying to run it in c9.io. I downloaded the chromedriver 64 bit version and gave permissions as 777 using chmod. Still I can't get it to work

However, I get the following error:

Traceback (most recent call last):
  File "/home/ubuntu/workspace/vroniplag/vroni.py", line 119, in <module>
    op('Aaf')
  File "/home/ubuntu/workspace/vroniplag/vroni.py", line 104, in op
    plags=getplags(cd)
  File "/home/ubuntu/workspace/vroniplag/vroni.py", line 92, in getplags
    driver = webdriver.Chrome(chromedriver)
  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 86, in start
    self.assert_process_still_running()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/common/service.py", line 99, in assert_process_still_running
    % (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service ./chromedriver unexpectedly exited. Status code was: 127

Can anybody tell me how to fix this

回答1:

I encountered the same issue and ran chromedriver --version gave me the exact error.

chromedriver: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

So the problem for me is the missing libraries (that chromedriver requires). So I installed those libraries and fixed the issue:

sudo yum install libX11 Gconf2 fontconfig


回答2:

I resolved this on Ubuntu 16.04 with the following:

$ sudo apt install libgconf-2-4


回答3:

I had the same issue but it was with the 32 bit version. Fixed it using the 64 bit version.