Windows 10找不到匹配的功能集

问题描述 投票:0回答:1

我刚刚为自己构建了一台新PC。正要刮擦某些东西,但出现错误“ 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
python selenium selenium-webdriver web-scraping geckodriver
1个回答
0
投票

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

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.