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:
- Error reporting in Firefox using selenium in Python
- Message: ‘geckodriver’ executable needs to be in PATH. [Solved]
- [Solved] Error in Python selenium + phantom JS alert() pop-up window
- How to Solve centos7 selenium–unknown error: DevToolsActivePort file doesn’t exist
- selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
- Mac environment and python + selenium environment are built to solve the error reporting problem of chromedriver
- Solve the problem of import error: cannot import name webriver
- selenium.common.exceptions.WebDriverException: Message: ‘geckodriver’ executable needs to…
- Selenium Error: Message: unknown error: cannot find Chrome binary
- Error when uirecorder starts webdriver service