在c9中运行硒

Ech*_*yak 4 python selenium c9.io

我正在尝试运行使用selenium模块的python代码.这段代码在我的PC中使用了一个chromedriver完美运行.我试图在c9.io中运行它.我下载了chromedriver 64位版本,并使用chmod授予777权限.我仍然无法让它发挥作用

但是,我收到以下错误:

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
Run Code Online (Sandbox Code Playgroud)

任何人都可以告诉我如何解决这个问题

Ton*_* Vu 6

我遇到了同样的问题并且跑chromedriver --version了给了我确切的错误.

chromedriver:加载共享库时出错:libX11.so.6:无法打开共享对象文件:没有这样的文件或目录

所以对我来说问题是缺少库(chromedriver要求).所以我安装了这些库并解决了问题:

sudo yum install libX11 Gconf2 fontconfig
Run Code Online (Sandbox Code Playgroud)

  • 这让我走上正轨(Ubuntu 64bit) - 缺少libgconf. (3认同)