由于硒问题,Quickstart.py无法运行

时间:2019-08-21 21:12:14

标签: python selenium

我找不到任何解决我问题的方法。

我已经在Amazon Lightail Ubuntu 18.04.3 LTS Linux中成功安装了Instapy。非常感谢您的任何建议。

当我尝试运行下面的简单测试脚本时。

我得到的部分错误-> selenium.common.exceptions.SessionNotCreatedException:消息:找不到匹配的功能集

This is the script I am trying to run. Full Error is further below. 

# imports
from instapy import InstaPy
from instapy import smart_run


# login credentials -  password delete intentionally. 
insta_username = '******'
insta_password = '*****'

# get an InstaPy session!
# set headless_browser=True to run InstaPy in the background
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser=True)


with smart_run(session):

 # activity            
session.like_by_tags(["natgeo"], amount=10)

我收到以下错误信息...

我可以识别出两个潜在的错误

  1. 执行self.error_handler.check_response(response)的文件“ /usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py”,第321行

  2. selenium.common.exceptions.SessionNotCreatedException:消息:找不到匹配的功能集

我认为错误必须与硒和Firefox浏览器有关,因为尝试在后台运行浏览器时提示错误(headless_browser = True)

请参阅下面的完整错误消息

 ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._. 
Workspace in use: "/home/ubuntu/InstaPy"
Traceback (most recent call last):
  File "quickstart.py", line 25, in <module>
    headless_browser=True)
  File "/usr/local/lib/python3.6/dist-packages/instapy/instapy.py", line 318, in __init__
    self.logger,
  File "/usr/local/lib/python3.6/dist-packages/instapy/browser.py", line 114, in set_selenium_local_session
    options=firefox_options,
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    keep_alive=True)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

我今天遇到了同样的问题,然后意识到第二个File调用是引用Firefox。因此,我在服务器上加载了Firefox,一切运行正常。不确定“快速入门”怎么错过了这个...

在此了解如何执行此操作: https://vitux.com/4-ways-to-install-mozilla-firefox-in-ubuntu/

  

方法2:通过命令行从官方Ubuntu存储库中

$ sudo apt-get update

$ sudo apt install firefox