Translate

How to add extensions firebug firepath to the instantiated firefoxdriver

In general when we Instantiate a Firefox Webdriver, the extensions(firebug,firepath) would not be added in that browser. In order to add them we can set firefox preferences by downloading XPI’S.
Wait..! but why do we need to add firebug? The answer is simple, I just want to measure network latency of AUT in each browser. Maybe you call this as APM (Application performance Monitoring)

What is XPI : A file with the extension XPI (pronounced zippy ) contains a Firefox browserextension.These are very similar to zip files.


FireBug XPI : Download from here,Place it in your drive.

FirePath XPI :Download from here,Place it in your drive.


You can also view the actual response time for each and every request sent to your application.Andyou can also get the cookies present.

Here i am sharing the code

import java.io.File;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.testng.annotations.Test;

public class AddExtensions{
private static WebDriver fd;

@Test
public void ms() throws Exception {
final String firebugPath = “D:\\firebug-1.12.0.xpi”;
final String firepathPath = “D:\\firepath-0.9.7-fx.xpi”;
FirefoxProfile profile = new FirefoxProfile();
profile.addExtension(new File(firebugPath));
profile.addExtension(new File(firepathPath));
String ext = “extensions.firebug.”;
String ext1 = “extensions.firepath.”;
//you need to Set default Firebug preferences and FirePath preferences
profile.setPreference(ext + “currentVersion”, “2.0.9”);
profile.setPreference(ext1 + “currentVersion”, “0.9.7”);
profile.setPreference(ext + “allPagesActivation”, “on”);
profile.setPreference(ext + “defaultPanelName”, “net”);
// profile.setPreference(ext + “defaultPanelName”, “cookies”);
profile.setPreference(ext + “net.enableSites”, true);
//profile.setPreference(ext + “cookies.enableSites”, true);
fd = new FirefoxDriver(profile);
fd.manage().window().maximize();
fd.get(“https://seleniumbycharan.wordpress.com”);
}
}

Now you can see Firebug and Firepath extension added to the browser.You can also see the response in ‘NET’ Panel.Please remove the comments in the code to get cookies too.

2 comments:

  1. Grear work. Learn lot How to add extensions firebug firepath to the instantiated firefoxdriver..Thanks for sharing this valuable content.keep update..Refer this pages also
    selenium training in chennai
    selenium training in velachery
    best selenium training in chennai

    ReplyDelete
  2. I was very interested in the article , it’s quite inspiring I should admit. I like visiting your site since I always come across interesting articles like this one. Keep sharing! Regards. Read more about
    Security Testing Services
    Test Automation Services
    Software Testing Services
    Compatibility Testing Services
    Regression Testing Services

    ReplyDelete