Last time I measured FF webdriver loading firefoxhttp://www.cnblogs.com/tobecrazy/p/3997375.html
So the question is, since the ability to load Firebug can be activated directly at runtime Firebug
The effect is as follows:
For this situation, we have two kinds of solutions
Method 1: Use the Firebug shortcut key F12 Activate Firebug
However, this requires using the SendKeys method of the Actions class, and using the SendKeys methods, do not forget to add the Perform () method otherwise do not perform
File file=NewFile ("C:\\webdriver\\firebug-2.0.4-fx.xpi");//Set Firebug pathFirefoxprofile profile =NewFirefoxprofile (); Profile.setpreference ("Network.proxy.type", 2); Profile.setpreference ("Network.proxy.autoconfig_url", "http://proxy.successfactors.com:8083");//Automatic proxy configuration Try { //Add Firebugprofile.addextension (file); Profile.setpreference ("Extensions.firebug.currentVersion", "2.0.4");//Setting the Firebug version } Catch(IOException e) {//TODO auto-generated Catch blockE.printstacktrace (); } webdriver Driver=Newfirefoxdriver (profile); Driver.get ("Http://www.dbyl.cn"); Actions Actions=NewActions (driver); //F12 is a short cut of active Firebug//Do not forget performActions.sendkeys (KEYS.F12). Perform (); Driver.manage (). window (). Maximize (); Driver.manage (). Timeouts (). Implicitlywait (60, Timeunit.seconds); Driver.manage (). Timeouts (). Pageloadtimeout ((Timeunit.seconds);
Another way is to use Firefox's setpreference directly
We note that the extensions.firebug.allPagesActivation of FF is set to On,firebug will be active
File file=NewFile ("C:\\webdriver\\firebug-2.0.4-fx.xpi");//Set Firebug pathFirefoxprofile profile =NewFirefoxprofile (); Profile.setpreference ("Network.proxy.type", 2); Profile.setpreference ("Network.proxy.autoconfig_url", "http://proxy.successfactors.com:8083");//Automatic proxy configuration Try { //Add Firebugprofile.addextension (file); Profile.setpreference ("Extensions.firebug.currentVersion", "2.0.4");//Setting the Firebug version//Active Firebug ExtensionsProfile.setpreference ("Extensions.firebug.allPagesActivation", "on"); } Catch(IOException e) {//TODO auto-generated Catch blockE.printstacktrace (); } webdriver Driver=Newfirefoxdriver (profile); Driver.get ("Http://www.dbyl.cn"); Actions Actions=NewActions (driver); Driver.manage (). window (). Maximize (); Driver.manage (). Timeouts (). Implicitlywait (60, Timeunit.seconds); Driver.manage (). Timeouts (). Pageloadtimeout ((Timeunit.seconds);
Selenium FF Webdriver 2 ways to turn Firebug on at runtime