尝试使用时出错webdriver.PhantomJS()来自硒

2024-09-26 22:08:17 发布

您现在位置:Python中文网/ 问答频道 /正文

Windows7、selenium 2.45.0、python 2.7.5、phantomjs 2.0.0

用pip安装了selenium(否则似乎可以正常工作),从http://phantomjs.org/download.html安装了phantomjs。将phantomjs的文件夹移到C:\Python27中的文件夹中,然后将C:\Python27…\bin\phantomjs添加到系统路径(尝试了phantomjs和幻影js.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幻影js.exe在路径中,改变服务.py文件,通过节点.js,在将其添加到path之后重新启动,并在PhantomJS()参数中使用executable_path=....。有什么其他想法吗?在


Tags: to路径文件夹seleniumwithjsphantomjsexe
1条回答
网友
1楼 · 发布于 2024-09-26 22:08:17

PhantomJS最近完全放弃了对Python的支持。然而,PhantomJS现在嵌入了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

相关问题 更多 >

    热门问题