Thursday, November 11, 2010

How to attach add-ons to your FirefoxDirver

A Typical sample like this, in case i forget how to do :)
 //Pre-condition: Right Clicking the button to save the add-on to some location  
final String firebugPath = "C:\\addon-1843-latest.xpi";  
FirefoxProfile profile = new FirefoxProfile();      
profile.addExtension(new File(firebugPath));  

WebDriver driver = new FirefoxDriver(profile);  

Another Sample is to set proxy for the FirefoxDriver:
FirefoxProfile profile = new FirefoxProfile();  
profile.setPreference("network.proxy.http", "YourDomain");  
profile.setPreference("network.proxy.http_port", port);  
profile.setPreference("network.proxy.type", 1);   
profile.setPreference("network.proxy.share_proxy_settings", true);  
WebDriver driver = new FirefoxDriver(profile);  

No comments:

Post a Comment