Unable to find a matching set of capabilities with selenium 3.4.3, firefox 54.0 and gecko driver 0.17

半城伤御伤魂 提交于 2019-11-26 09:14:27

问题


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

After running the above code I am getting an error as :

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

回答1:


I don't see any significant error in your code as such.

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

Here is your own code with a simple tweak which opens the Mozilla Firefox browser:

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")



回答2:


Make sur you are pointing to \path\to\FirefoxPortable\App\Firefox64\firefox.exe and not just \path\to\FirefoxPortable\FirefoxPortable.exe



来源:https://stackoverflow.com/questions/44601126/unable-to-find-a-matching-set-of-capabilities-with-selenium-3-4-3-firefox-54-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!