Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
deprecated example using a firefox plugin
public void firefoxUseExtensions() throws IOException {
// **************************************************************************
// profile is good for setting preferences and fiddling with browser settings
// **************************************************************************
// Download the extension to a local folder
String s = File.separator;
String extensionPath = System.getProperty("user.dir") +
FirefoxProfile profile = new FirefoxProfile();
// stop firebug showing the first run screen by setting the last version
// to the current one
profile.setPreference("extensions.firebug.currentVersion", "1.10.5");
// add the extension to firefox
profile.addExtension(new File(extensionPath));
// prior to 3.12.0 we could set the profile
//WebDriver firefox = new FirefoxDriver(profile);
// in 3.12.0 we use the option
FirefoxOptions options = new FirefoxOptions().setProfile(profile);
WebDriver firefox = new FirefoxDriver(options);
assertThat(firefox.getTitle(), is("HTML Form Elements"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment