本文介绍了“无法找到匹配的功能集". -Selenium与Python 2.7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Python 2.7和Firefox Portable 54(64位)中使用Selenium 3.8.1,运行此脚本时出现以下错误消息:
Using Selenium 3.8.1 with Python 2.7 with Firefox Portable 54, 64 bit, I get the following error message when running this script:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary_argument = FirefoxBinary(r'C:\Users\[removed]\FirefoxPortable.exe')
driver = webdriver.Firefox(firefox_binary=binary_argument)
driver.get("http://icanhazip.com")
.
Traceback (most recent call last):
File "F:/cp/python-selenium3/ToyScripts/launch_portable_browser.py", line 5, in <module>
driver = webdriver.Firefox(firefox_binary=binary_argument)
File "C:\ProgramData\Anaconda2\envs\automation2\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 162, in __init__
keep_alive=True)
File "C:\ProgramData\Anaconda2\envs\automation2\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 154, in __init__
self.start_session(desired_capabilities, browser_profile)
File "C:\ProgramData\Anaconda2\envs\automation2\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\ProgramData\Anaconda2\envs\automation2\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "C:\ProgramData\Anaconda2\envs\automation2\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
在闪屏消失之前,我确实看到了片刻.另外值得注意的是,手动使用浏览器时可以正常工作.
I do see the splash screen for a moment before it disappears. Also worth noting is that the browser works fine when used manually.
我怀疑便携式浏览器需要切换一些设置以允许Selenium接管,但这是我所知道/怀疑的程度.
I suspect that the portable browser needs some settings switched to allow Selenium to take over, but that is the extent of what i know/suspect.
谢谢您的帮助.
推荐答案
通过修改DesiredCapabilities解决:
Solved by modifying DesiredCapabilities:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
binary_argument = FirefoxBinary(r'C:\Users\[removed]\FirefoxPortable.exe')
capabilities_argument = DesiredCapabilities().FIREFOX
capabilities_argument["marionette"] = False
driver = webdriver.Firefox(firefox_binary=binary_argument, capabilities=capabilities_argument)
driver.get("http://icanhazip.com")
这篇关于“无法找到匹配的功能集". -Selenium与Python 2.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!