2011/09/13

Setting Firefox Preferences via Selenium 2 (WebDriver API)

I wanted to run Firefox from WebDriver with custom preferences.  So I looked into the well-known about:config for name of the option and, just to be sure, consulted About:config entries section of Mozilla Wiki.


With the name of desired config option to change, the rest is a pieceof cake:

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("dom.event.contextmenu.enabled",false);
WebDriver webDriver =  new FirefoxDriver(profile);

No comments:

Post a Comment