surroundings:
1, ubuntu system
2、selenium 3.141.0
3, Firefox driving geckodriver-v0.24.0-linux32
Execute scripts in Python:
from selenium import webdriver
browser = webdriver.Firefox()
结果提示: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
1, enter firefox official website to download the latest version from the browser Firefox-latest.tar.bz2
2, enter the download directory, unzip the file.
3, open a terminal emulator, proceeds to download directory, enter the command-line installation.
root @ yanner-VirtualBox: home / yanner / download / firefox # sudo apt-get install firefox /
After the update, Firefox 52.0.2
Execute the script again, normally open the browser.