2

&を使用 firefox12してダウンロードしましたが、harファイルが作成されません。実行できる変更。プログラムコード: firebug-1.9.0.xpinetExport-0.5.xpi

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

        }

    }
}
4

1 に答える 1

2

おそらく最善の策は、Browsermob プロキシを Selenium と組み合わせて使用​​することです。プラグインなしで Firefox を実行し、har ファイルを出力できます。このプロジェクトには、Selenium の作成者と、その他の有名な人物が参加しています。Github プロジェクトには、Har ファイルを作成する方法を示すサンプルがあります。そこから、独自のコードを記述してそれを処理し、パフォーマンス メトリックが満たされていることを確認したり、含まれている javascript / css が配置されていることを確認したり、ディスクに書き込んだりできます。...

于 2012-07-30T13:28:43.923 に答える