无法找到与selenium 3.4.3、firefox 54.0和gecko驱动程序0.17匹配的功能集

2024-05-15 10:09:56 发布

您现在位置:Python中文网/ 问答频道 /正文

if __name__ == '__main__':
 driver=webdriver.Firefox(executable_path=r'/home/saurabh/Saurabh/LearnPython/Automation/geckodriver');

运行上述代码后,我得到一个错误:

selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

Tags: path代码namehomeifmaindriverfirefox
2条回答

确保你指向的是\path\to\FirefoxPortable\App\Firefox64\firefox.exe而不仅仅是\path\to\FirefoxPortable\FirefoxPortable.exe

我认为您的代码本身没有任何重大错误

It is to be noted that the current Selenium-Python binding is unstable with geckodriver and looks to be Architecture specific. You can find the github discussion and merge here. So you may additionally need to pass the absolute path of the firefox binary as firefox_binary argument while initializing the webdriver

以下是您自己的代码,其中有一个简单的调整可以打开Mozilla Firefox浏览器:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

if __name__ == '__main__':

    binary = FirefoxBinary('C:\\Program Files\\Mozilla Firefox\\firefox.exe')
    driver = webdriver.Firefox(firefox_binary=binary, executable_path="C:\\path\\to\\geckodriver.exe")

相关问题 更多 >