Skip to content

Instantly share code, notes, and snippets.

@epall
Created February 10, 2011 23:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epall/821592 to your computer and use it in GitHub Desktop.
Save epall/821592 to your computer and use it in GitHub Desktop.
Setting firefox profile preferences with RemoteWebDriver
import org.openqa.selenium.*;
import org.openqa.selenium.remote.*;
import org.openqa.selenium.firefox.*;
public class CustomFirefoxProfile {
public static void main(String[] args) throws Exception {
DesiredCapabilities capabillities = new DesiredCapabilities("firefox", "3.6.", Platform.WINDOWS);
capabillities.setCapability("job-name", "Fancy Firefox profile");
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("network.http.phishy-userpass-length", 255);
capabillities.setCapability(FirefoxDriver.PROFILE, profile);
WebDriver driver = new RemoteWebDriver(new java.net.URL("http://USERNAME:ACCESS_KEY@ondemand.saucelabs.com:80/wd/hub"), capabillities);
driver.quit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment