Under Ubuntu system, selenium opens the Firefox browser and prompts’ unable to find a matching set of capabilities. And message: connect

Environment.

1.ubuntu system

2.selenium 3.141.0

3.Firefox driver geckodriver-v0.24.0-linux32

To execute the script in Python.

from selenium import webdriver
browser = webdriver.Firefox()

Result tips: Message: Unable to find a matching set of capabilities

Traceback (most recent call last):
File “/home/yanner/seleniumtest/sousuo.py”, line 2, in <module>
browser = webdriver.Firefox()
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py”, line 174, in __init__
keep_alive=True)
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”, line 157, in __init__
self.start_session(capabilities, browser_profile)
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”, line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”, line 321, in execute
self.error_handler.check_response(response)
File “/usr/local/lib/python2.7/dist-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

Solution: Update firefox browser</strong

1. Go to the official firefox website from your browser and download the latest version of firefox-67.0.4.tar.bz2

2. Go to the download directory and unzip the file. </strong

3. Open the terminal emulator, go to the download directory, and enter the install command line. <strong

root@yanner-VirtualBox:/home/yanner/download/firefox# sudo apt-get install firefox
After updating, Firefox 52.0.2

Execute the script again to open the browser normally:

from selenium import webdriver
browser = webdriver.Firefox()

However, opening the page fails with the message Message: connection refused:

from selenium import webdriver
browser = webdriver.Firefox()
browser.get(“http://www.baidu.com”)
browser.find_element_by_id(“kw”).send_keys(“selenium”)
browser.find_element_by_id(“su”).click()
browser.quit()

After half a day of research, the driver geckodriver-v0.24.0-linux32 down version, the directory /usr/local/bin under the driver geckodriver deleted, downloaded geckodriver-v0.17.0-linux32 unzip copy to /usr/local/bin

Run the above script again and it opens normally!

Similar Posts: