小编cdf*_*dfh的帖子

Selenium Python无头Webdriver(PhantomJS)不工作

所以我很难让硒与无头驱动器,特别是PhantomJS一起工作.我试图让它在Ubuntu网络服务器(Ubuntu 14.04.2 LTS)上运行.

从python解释器(Python 2.7.6)运行以下命令给出:

from selenium import webdriver
driver = webdriver.PhantomJS()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/phantomjs/webdriver.py", line 51, in __init__
    self.service.start()
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/phantomjs/service.py", line 76, in start
    raise WebDriverException("Unable to start phantomjs with ghostdriver: %s" % e)
selenium.common.exceptions.WebDriverException: Message: Unable to start phantomjs with ghostdriver: [Errno 2] No such file or directory
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

driver = webdriver.PhantomJS(executable_path="/usr/local/lib/python2.7/dist-packages/selenium/webdriver/phantomjs/")

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/phantomjs/webdriver.py", line 51, …
Run Code Online (Sandbox Code Playgroud)

python linux selenium phantomjs splinter

7
推荐指数
1
解决办法
8038
查看次数

标签 统计

linux ×1

phantomjs ×1

python ×1

selenium ×1

splinter ×1