简体   繁体   English

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

[英]Quickstart.py failed to run due to selenium issue

I cannot find anywhere solution to my issue. 我找不到任何解决我问题的方法。

I have installed Instapy successfully in Amazon lightsail Ubuntu 18.04.3 LTS Linux. 我已在Amazon Lightail Ubuntu 18.04.3 LTS Linux中成功安装了Instapy。 Thank you so much for any suggestion. 非常感谢您的任何建议。

When I tried to run the simple test script below. 当我尝试运行下面的简单测试脚本时。

I get as part of the error -> selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities 作为错误的一部分,我得到了-> 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)

I get the following error... 我收到以下错误...

I can identify 2 potential errors 我可以找出2个潜在的错误

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

  2. selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities selenium.common.exceptions.SessionNotCreatedException:消息:找不到匹配的功能集

I think the errors has to be related to selenium and Firefox browser , as the error is prompted while trying to run the browser in the background (headless_browser=True) 我认为错误必须与selenium和Firefox浏览器有关,因为尝试在后台运行浏览器时会提示错误(headless_browser = True)

See full error message below 请参阅下面的完整错误消息

 ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._. 
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

Thanks for your help! 谢谢你的帮助!

I had the same issue today, then realized the second File call was referencing Firefox. 今天我遇到了同样的问题,然后意识到第二个File调用是引用Firefox。 So, I loaded Firefox on the server and things worked perfectly. 因此,我在服务器上加载了Firefox,一切运行正常。 Not sure how the "Quickstart" missed this... 不确定“快速入门”如何错过了这个...

Found out how to do that here: https://vitux.com/4-ways-to-install-mozilla-firefox-in-ubuntu/ 在这里找到如何执行此操作: https : //vitux.com/4-ways-to-install-mozilla-firefox-in-ubuntu/

Method 2: From the Official Ubuntu Repository-through the Command Line 方法2:通过命令行从官方Ubuntu存储库

$ sudo apt-get update

$ sudo apt install firefox

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 适用于我的 Google Sheets 电子表格的 Python quickstart.py - Python quickstart.py adapted to my Google Sheets spreadsheet Google API quickstart.py 错误 KeyError: &#39;_module&#39; - Google API quickstart.py error KeyError: '_module' Gmail API quickstart.py脚本返回KeyError&#39;_module&#39; - Gmail API quickstart.py script returns KeyError '_module' 尝试使用python访问“google drive”时出错(google quickstart.py源代码) - Error trying to access “google drive” with python (google quickstart.py source code) 由于 JSONDecodeError:额外数据,Google 的 quickstart.py 未连接到 Google Workspace API - Google's quickstart.py not connecting to Google Workspace API because of JSONDecodeError: Extra data Google Drive API Quickstart.py 错误 400:redirect_uri_mismatch - Google Drive API Quickstart.py Error 400: redirect_uri_mismatch PY2EXE和硒问题 - PY2EXE and SELENIUM ISSUE 无法使用 Selenium 在 Pycharm 中运行基本 Py 程序 - unable to run basic Py program in Pycharm with Selenium 设置py2app以运行硒 - Setting up py2app to run selenium PyCharm Error when setting remote interpreter -&gt; Run Error: Jupyter server process failed to start due to path mismatch 问题 - PyCharm Error when setting remote interpreter -> Run Error: Jupyter server process failed to start due to path mismatch issue
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM