我在Raspbian 8(Jessie)上,最近安装了Selenium和PhantomJS(分别使用sudo pip install selenium
和sudo apt-get install phantomjs
)。现在,当我尝试在Python交互式终端中运行以下代码时
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 52, in __init__
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 phantomjs unexpectedly exited. Status code was: 0
并且ghostdriver.log
文件显示为:
Unknown option '--webdriver=46183'
我不知道为什么会这样,并会感谢一些帮助。谢谢!