Selenium FF Webdriver 2 ways to turn Firebug on at runtime

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.