2014-01-18 29 views
2

我试图通过http://blog.likewise.org/2013/04/webdriver-testing-with-python-and-ghostdriver/工作。我的开发环境是win7上的USB驱动器。我已经phantomjs.exe上:试图在win7上设置硒/ phantomjs的路径

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 

我怎样才能解决这个问题?

回答

2

Can't run PhantomJS in python via Selenium,我从我的virtualenv卸载硒就跑:

pip install selenium==2.37 

到目前为止,这一直为我工作,虽然上述条款表明,至少有一些问题。

+0

这个问题似乎是修正在硒2.42.1 – Loknar

+1

为什么不把它作为一个答案? – user61629