The legacy Firefox Driver was developed as a browser extension by the Selenium Developers. Firefox updated their security model, so it no longer works. You now need to use geckodriver.
This documentation previously located on the wiki
You can read more about geckodriver.
Firefox driver is included in the selenium-server-stanalone.jar available in the downloads. The driver comes in the form of an xpi (firefox extension) which is added to the firefox profile when you start a new instance of FirefoxDriver.
ProsThe following system properties (read using System.getProperty()
and set using System.setProperty()
in Java code or the “-DpropertyName=value
” command line flag) are used by the FirefoxDriver:
Normally the Firefox binary is assumed to be in the default location for your particular operating system:
OS Expected Location of Firefox Linux firefox (found using “which”) Mac /Applications/Firefox.app/Contents/MacOS/firefox-bin Windows %PROGRAMFILES%\Mozilla Firefox\firefox.exeBy default, the Firefox driver creates an anonymous profile
Running with firebugDownload the firebug xpi file from mozilla and start the profile as follows:
File file = new File("firebug-1.8.1.xpi");
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.addExtension(file);
firefoxProfile.setPreference("extensions.firebug.currentVersion", "1.8.1"); // Avoid startup screen
WebDriver driver = new FirefoxDriver(firefoxProfile);
FirefoxDriver Internals
(Previously located: https://github.com/SeleniumHQ/selenium/wiki/FirefoxDriver-Internals)
The FirefoxDriver is largely written in the form of a Firefox extension. Language bindings control the driver by connecting over a socket and sending commands (described in the JsonWireProtocol page) in UTF-8. The extension makes use of the XPCOM primitives offered by Firefox in order to do its work. The important thing to notice is that the command names map directly on to methods exposed on the “FirefoxDriver.prototype” in the javascript code.
Working on the FirefoxDriver CodeFirstly, make sure that there’s no old version of the FirefoxDriver installed:
firefox -ProfileManager
Secondly, take a look at the Mozilla Developer Center, particularly the section to do with setting up an extension development environment. You should now be ready to edit code. It’s best to create a test around the area of code that you’re working on, and to run this using the SingleTestSuite
. The FirefoxDriver logs errors to Firefox’s error console (“Tools->Error Console”), so if a test fails, that’s a great place to start looking.
To actually log information to the console, use the “Utils.dumpn()
” method in your javascript code. If you find that you’d like to examine an object in detail, use the “Utils.dump()
” method, which will report which interfaces an object implements, as well as outputting as much information as it can to the console..
The following steps are performed when instantiating an instance of the FirefoxDriver:
Learn more or view the full list of sponsors.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4