Wednesday, 4 December 2013

Selenium & Performance Testing | Firebug

Note:  Text in ORANGE can be edited or mentioned important for this entire blog

NetExport Firebug extension is used to find out the actual response time for each and every request sent.  I have used the Firefox profile to do this.

Configure netExport

1| Download Firebug Firefox add-on
2| Download netExport Firefox add-on. [netExport is a part of Firebug]


NetExport Firebug extension is used for exporting the data collected by Net panel

3| Manual Export option is available to download the data in .HAR format. [Here, we are going to do the same using Selenium Webdriver]


4| The downloaded .har log can be viewed later to check performance of the site. [This can done using harviewer]
5| Drag the .har log from local directory and drop it anywhere inside the page mentioned in step 4. (or)
Copy the .har log contents and paste it into the text box and press the preview button.



Snippet | netExport

ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("default"); //Here, default is the Firefox profile
 
// Set default Firefox preferences
myprofile.setPreference("app.update.enabled", false);

String domain = "extensions.firebug.";

// Set default Firebug preferences
myprofile.setPreference(domain + "currentVersion", "2.0");
myprofile.setPreference(domain + "allPagesActivation", "on");
myprofile.setPreference(domain + "defaultPanelName", "net");
myprofile.setPreference(domain + "net.enableSites", true);

// Set default NetExport preferences
myprofile.setPreference(domain + "netexport.alwaysEnableAutoExport", true);
myprofile.setPreference(domain + "netexport.showPreview", false);
myprofile.setPreference(domain + "netexport.defaultLogDir", "C:\\Test\\"); //Set the local directory here

driver = new FirefoxDriver(myprofile);


Load Add-on from Local Directory [acts just like incognito Window]

#1 Custom Profile
ProfilesIni profile = new ProfilesIni();
final String firebugPath = "C:\\firebug-1.12.5.xpi";
FirefoxProfile myprofile = profile.getProfile("sams");   
myprofile.addExtension(new File(firebugPath));
  
String domain = "extensions.firebug.";

// Set default Firebug preferences
myprofile.setPreference(domain + "currentVersion", "2.0");
myprofile.setPreference(domain + "allPagesActivation", "on");
myprofile.setPreference(domain + "defaultPanelName", "console");
myprofile.setPreference(domain + "net.enableSites", true);
  
driver = new FirefoxDriver(myprofile);

#2  New Profile
final String firebugPath = "C:\\firebug-1.12.5.xpi";
FirefoxProfile myprofile = new FirefoxProfile();       
myprofile.addExtension(new File(firebugPath));

String domain = "extensions.firebug.";

// Set default Firebug preferences
myprofile.setPreference(domain + "currentVersion", "2.0");
myprofile.setPreference(domain + "allPagesActivation", "on");
myprofile.setPreference(domain + "defaultPanelName", "net");
myprofile.setPreference(domain + "net.enableSites", true);

driver = new FirefoxDriver(myprofile); 


Note: 
1| consoleExport is another tool similar to netExport;  consoleExport can be saved in .html format and viewed manually through browser.

8 comments:

  1. Hi Prasanth ,

    Its really a fantastic Post :) !! Thanks for sharing ! I want to know are there any solutions in Selenium to fetch or capture values from Google Tag assistant to fetch values for Google tag manager ??


    Thanking you in advance !!

    Thanks,
    Ananth .

    ReplyDelete
  2. Thanks for the great information in your blog Selenium Training in Chennai

    ReplyDelete
  3. Thanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about SAP BASIS.SAP basis

    ReplyDelete
  4. It was very nice blog to learn about SAP BASIS. Thanks for sharing.SAP basis

    ReplyDelete
  5. Best place to learn Appium Android IOS Automation Testing Training in Chennai

    Go for Appium training in chennai for real time mobile automation testing training with real time project support.
    UI Automation Tools with real time scenarios You can contact 8122241286 for Best APPIUM and selenium Training in Chennai

    ReplyDelete
  6. Usually I do not read post on blogs, but I would like to say that this write-up very forced me to try and do it! Your writing style has been surprised me. Great work admin.Keep update more blog.
    Mobile App Development Company
    Android app Development Company
    ios app development Company
    Mobile App Development Companies

    ReplyDelete
  7. Nice article.People willing to get the indepth knowledge in getting framework such as TestNG,jenkins,Maven and POM should get properly get selenium training in chennai
    Also for other specific java related training please check below
    best selenium training in chennai | Android training in chennai | Java training in chennai

    ReplyDelete