【问题标题】:Automate Page Load Performance Testing with Firebug and Selenium使用 Firebug 和 Selenium 自动化页面加载性能测试
【发布时间】:2012-07-30 21:28:43
【问题描述】:

我正在使用firefox12 并下载了firebug-1.9.0.xpinetExport-0.5.xpi,但没有创建har 文件。可以做的任何改变。程序代码:

   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();

        }

    }
}

【问题讨论】:

    标签: c# selenium firebug webdriver


    【解决方案1】:

    您最好的选择可能是将Browsermob proxy 与 Selenium 结合使用。它将允许您在没有插件的情况下运行 Firefox,并输出 har 文件。该项目有 Selenium 的创建者和其他一些知名人物。 Github Project 有一个示例,展示了如何创建 Har 文件,从那里您可以编写自己的代码来处理它并确保满足您的性能指标,或者您包含的 javascript / css 已定位,将其写入光盘,等等……

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-11-24
      • 2015-02-25
      • 1970-01-01
      • 1970-01-01
      • 2021-01-10
      • 2012-09-27
      • 2014-05-11
      相关资源
      最近更新 更多