调用phantomJs 失败

from selenium import webdriver
driver = webdriver.PhantomJS(executable_path="C:\Python27\phantomjs\phantomjs.exe")
driver.get("https://www.baidu.com")
data = driver.title
print data

clipboard.png

阅读 3.6k
2 个回答
driver = webdriver.PhantomJS(executable_path="C:\\Python27\\phantomjs\\phantomjs.exe")

图片描述

直接复制你的代码,跑起来没啥问题,你检查下 selenium 的版本,或者C 盘的权限,是不是没法访问,还有就是重新下载 phantomjs.exe,第一次启用 phantomjs 的时候回提示联网,点击允许。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题