Pat
Pat

Reputation: 727

Automate Page Load Performance Testing with Firebug and Selenium

I am using firefox12 and downloaded firebug-1.9.0.xpi & netExport-0.5.xpi, but the har file is not created. Any changes that can be done. Program Code:

   class Program 
   {
    public IWebDriver webDriver;
    public InternetExplorerDriver IEDriver;
    static void Main(string[] args)
    {
        {
            FirefoxProfile profile = new FirefoxProfile();
            IWebDriver webDriver = new FirefoxDriver();
            try
            {
                profile.AddExtension(@"D:\LoadTesting\firebug-1.9.0.xpi");
                profile.AddExtension(@"D:\LoadTesting\netExport-0.5.xpi");
            }
            catch (IOException err)
            {

            }
            profile.SetPreference("app.update.enabled", false);
            String domain = "extensions.firebug.";
            string output_dir =
        Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            output_dir = Path.Combine(output_dir, "Firebugnetexports");
            if (!Directory.Exists(output_dir))
            {
                Directory.CreateDirectory(output_dir);
            }

            profile.SetPreference(domain + "currentVersion", "1.8.2");
            profile.SetPreference(domain + "allPagesActivation", "on");
            profile.SetPreference(domain + "defaultPanelName", "net");
            profile.SetPreference(domain + "net.enableSites", true);
            profile.SetPreference(domain + "netexport.alwaysEnableAutoExport", true);
            profile.SetPreference(domain + "netexport.showPreview", false);
            profile.SetPreference(domain + "netexport.defaultLogDir", output_dir);
            try
            {

                webDriver.Navigate().GoToUrl("http://www.janodvarko.cz");
            }
            catch (Exception ex)
            {

            }
            webDriver.Quit();

        }

    }
}

Upvotes: 2

Views: 1631

Answers (1)

Scott
Scott

Reputation: 9488

Your best bet would probably be to use Browsermob proxy in conjunction with Selenium. It will allow you to run Firefox without plugins, and to output the har file. The project has the creator of Selenium on board, and some other well known figures. The Github Project has a sample which shows how to create the Har file, from there you could write your own code to process it and ensure your performance metrics are met, or that your included javascript / css was located, write it to disc, etc...

Upvotes: 2

Related Questions