我正在努力解决 http://blog.likewise.org/2013/04/webdriver-testing-with-python-and-ghostdriver/ .我的开发环境是win7上的u盘。我有 phantomjs.exe:
f:/phantomjs.exe
使用 python REPL,我根据文章完成了以下操作:
>>> from selenium import webdriver
>>> driver = webdriver.PhantomJS(executable_path="F:\phantomjs.exe")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "F:\envs\r1\lib\site-packages\selenium\webdriver\phantomjs\webdriver.py", line 50, in __init__
self.service.start()
File "F:\envs\r1\lib\site-packages\selenium\webdriver\phantomjs\service.py", line 66, in start
raise WebDriverException("Unable to start phantomjs with ghostdriver.", e)
WebDriverException: Message: 'Unable to start phantomjs with ghostdriver.' ; Screenshot: available via screen
我该如何解决这个问题?
请您参考如下方法:
正在关注 Can't run PhantomJS in python via Selenium ,我从我的 virtualenv 中卸载了 selenium 并运行:
pip install selenium==2.37
到目前为止,这一直对我有用,尽管上面的文章至少表明存在一些问题。
