unable to load Atom 'find_element' (Ubuntu &deepin)

PhantomJS:unable to load Atom ‘find_element’ (Ubuntu &deepin)


  1. 问题描述

    在ubuntu(deepin)下写python爬虫时,使用phantomjs模拟登陆,出现以下错误:

    Traceback (most recent call last):
      File "<PATHTOFILE>", line 20, in <module>
        driver.find_element_by_id('lst-ib').send_keys('something' + Keys.RETURN)
      File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 266, in find_element_by_id
        return self.find_element(by=By.ID, value=id_)
      File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 744, in find_element
        {'using': by, 'value': value})['value']
      File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 233, in execute
        self.error_handler.check_response(response)
      File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 165, in check_response
        raise exception_class(value)
    selenium.common.exceptions.WebDriverException: Message: Error - Unable to load Atom 'find_element' from file ':/ghostdriver/./third_party/webdriver-atoms/find_element.js'
    
  2. 问题原因

    安装phantomjs时,采用apt-get install phantomjs方式安装,但它不是一个全功能的phantomjs版本.

  3. 解决办法

    1.卸载旧版本
    apt purge phantomjs
    2.通过Wget下载phantomjs
    wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
    3.解压
    tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2
    4.将phantomjs文件移动到/usr/bin/
    sudo cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/bin/
    
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值