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

1683 ワード

PhantomJS:unable to load Atom ‘find_element’ (Ubuntu &deepin)
  • 問題記述ubuntu(deepin)でpython爬虫類を書く場合、phantomjsシミュレーションを使用してログインし、
    Traceback (most recent call last):
      File "", line 20, in 
        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'
    
  • というエラーが発生しました.
  • 問題原因phantomjsをインストールする場合、apt-get install phantomjs方式でインストールするが、フル機能のphantomjsバージョンではない.
  • 解決策
    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/