【问题标题】:why I can't use the PhantomJs in Selenium为什么我不能在 Selenium 中使用 PhantomJs
【发布时间】:2017-03-29 08:18:04
【问题描述】:
sudo apt-get install selenium
sudo apt-get install phantomjs

我在 ubuntu 16.04 下安装了 selenium 和 phantomjs。但是当

从硒导入网络驱动程序

浏览器 = webdrive.PhantomJs()

Python 解释器给出错误消息,AttributeError: 'module' object has no attribute 'PhantomJs'。我不知道出了什么问题。谁能给点建议。对此我将不胜感激。

【问题讨论】:

  • 你在调用 PhantomJS() 时错过了webdriver 的最后一个字母

标签: python selenium phantomjs


【解决方案1】:

Ubuntu 会自动为 python2 安装 selenium,你应该使用这个命令为 py3 安装 phantomjs

sudo pip3 install -U selenium

并确保在运行脚本时指定 Python 解释器版本 3

【讨论】:

    猜你喜欢
    • 2021-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-06
    相关资源
    最近更新 更多