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.

5 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. It was very nice blog to learn about SAP BASIS. Thanks for sharing.SAP basis

    ReplyDelete
  3. 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
  4. This was nice and amazing and the given contents were very useful and the precision has given here is good.

    Best Apache Spark Online Course
    Apache Spark and Scala Online Training

    ReplyDelete