【问题标题】:Unable to find a matching set of capabilities, Windows 10无法找到匹配的功能集,Windows 10
【发布时间】:2020-01-20 05:31:07
【问题描述】:

我刚刚为自己打造了一台新电脑。正要刮东西,但我收到错误“Unable to find a matching set of capabilities”。不知道为什么会触发此错误?

版本

Windows 10 Home 10.0.18362 Build 18362 (x64)
Firefox 69.0.1 (64-bit) # also tried with the last version of firefox
Python 3.7.4 (64 bit (AMD64))
Selenium 3.141.0
Geckodriver 0.25.0 (64-bit, though I've tried with the 32-bit one and same error)

堆栈跟踪错误

File "C:\Users\Anthony\Desktop\ZzzGiants\Scrape\name_dictionary.py", line 30, in create_webdriver_instance
    return webdriver.Firefox()

脚本

# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options

def create_webdriver_instance():
    #options = Options()
    #options.add_argument('--headless')
    #return webdriver.Firefox(options=options)
    return webdriver.Firefox()
    """ commented out the options because i was getting this error, but error still persists """

ff = create_webdriver_instance()
...

堆栈跟踪的其余部分

File "C:\Users\Anthony\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 174, in __init__
    keep_alive=True)
File "C:\Users\Anthony\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
File "C:\Users\Anthony\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\Anthony\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
File "C:\Users\Anthony\AppData\Local\Programs\Python\Python37\lib\site-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

【问题讨论】:

  • github.com/SeleniumHQ/selenium/issues/3884 github上这个issue thread中的所有解决方案你都试过了吗?
  • @BugWhisperer 使用错误堆栈跟踪更新问题
  • @BugWhisperer thisthis 讨论对您有帮助吗?
  • @DebanjanB CMD Error 是堆栈跟踪终止的地方,但我从堆栈跟踪中添加了更多内容。如果您发现任何有趣的事情,请告诉我
  • @Kraay89 问题已解决。参考我对这个问题的回答

标签: python selenium selenium-webdriver web-scraping geckodriver


【解决方案1】:

问题出在 Firefox 安装上。当 Selenium 不工作时,它最初安装在一个奇怪的目录中。一个简单的重新安装到C:\Program Files\Mozilla Firefox 似乎可以解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-07-30
    • 1970-01-01
    • 2018-01-26
    • 1970-01-01
    • 1970-01-01
    • 2018-07-30
    • 2019-04-04
    相关资源
    最近更新 更多