Windows7,selenium 2.45.0,python 2.7.5,phantomjs 2.0.0
用pip安装了selen(否则似乎工作正常),从http://phantomjs.org/download.html安装了phantomjs。将phantomjs的文件夹移动到C:\ Python27中的文件夹中,然后将C:\ Python27 ... \ bin \ phantomjs添加到系统路径(尝试了phantomjs和phantonjs.exe)。只要使用driver = webdriver.PhantomJS()
,就会发生这种情况......
错误:
raise WebDriverException("Unable to start phantomjs with ghostdriver.", e)
WebDriverException: Message: Unable to start phantomjs with ghostdriver.
Screenshot: available via screen
尝试了到目前为止我能找到的每个解决方案:恢复到版本2.37.0,在路径中尝试phantomjs vs phantomjs.exe,更改service.py文件,通过node.js安装,在将其添加到路径后重新启动,以及在PhantomJS()参数中使用executable_path=....
。还有其他想法吗?
答案 0 :(得分:-1)
PhantomJS最近完全放弃了Python支持。但是,PhantomJS现在嵌入了Ghost Driver。
此后,一个新项目加紧填补空白:Ghost.py(http://jeanphix.me/Ghost.py/)。您可能想要使用它:
from ghost import Ghost
ghost = Ghost()
page, extra_resources = ghost.open("http://jeanphi.fr")
assert page.http_status==200 and 'jeanphix' in ghost.content