This article is based on a previously written Chrome+selenium+python environment configuration, linked http://blog.csdn.net/zxy987872674/article/details/53082896
Before writing selenium script, all use of Chrome browser, see a lot of people say that Firefox does not need to install additional driver to fit selenium, thought can run directly, but today installed selenium IDE environment, want to use the next Firefox browser, Just write a script to test it:
from selenium import webdriverimport timedriver = webdriver.Firefox()driver.get("http://www.baidu.com")time.sleep(3)driver.quit()
Results hint:
Message: ‘geckodriver‘ executable needs to be in PATH.
Refer to the chrome environment installation process to access the official website:
http://docs.seleniumhq.org/download/Select the corresponding system browser driver, I downloaded the geckodriver-v0.11.1-macos.tar.gz, the extracted geckodriver moved to/usr /local/bin directory, rerun the script;
raise exception_class(message, screen, stacktrace)selenium.common.exceptions.WebDriverException: Message: Missing ‘marionetteProtocol‘ field in handshake
The specific cause of the error is unknown, the Firefox upgrade to the Firefox 49.0.2, rerun the script, can run normally.
Mac Os+selenium2+firefox Driver +python3