さまざまなブラウザで動作するhtmlドキュメントのスナップショットを作成する際に問題があります。 私はブラウザコンプ能力テストのために別のブラウザ(すなわちなどクローム、ファイアーフォックス)でWebページの実行のスナップショットを取りたいが、私は、HTML文書のロード時間の問題を取得し、ここに私のコードで、Htmlドキュメントが完全に読み込まれたときに、別のブラウザでHtmlドキュメントを取得する方法
private void button1_Click(object sender, EventArgs e)
{
//Process p = new Process();
// p.StartInfo = new ProcessStartInfo();
foreach (string key in ConfigurationManager.AppSettings.Keys)
{
Process p = new Process();
p.StartInfo = new ProcessStartInfo();
p.StartInfo.FileName = ConfigurationManager.AppSettings[key];
p.StartInfo.Arguments = @"www.google.com";
p.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
p.Start();
p.PriorityClass = ProcessPriorityClass.High;
System.Threading.Thread.Sleep(30000);
Rectangle bounds = Screen.GetBounds(Point.Empty);
using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
}
bitmap.Save("E:\\ChandraPrakash\\My Testings\\Screen Grab\\Images\\screen_shot" + key + ".jpg", ImageFormat.Jpeg);
}
this.WindowState = FormWindowState.Normal;
this.BringToFront();
this.Focus();
//p.Kill();
}
}
ています
と私はapp.configのコードは、
ここ<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Chrome" value="C:\Documents and Settings\uba\Local Settings\Application Data\Google\Chrome\Application\chrome.exe"/>
<add key="Firefox" value="C:\Program Files\Mozilla Firefox\firefox.exe"/>
<add key="Safari" value="C:\Program Files\Safari\Safari.exe"/>
<add key="Ie" value="C:\Program Files\Internet Explorer\IEXPLORE.EXE"/>
<add key="Opera" value="C:\Program Files\Opera\opera.exe"/>
</appSettings>
</configuration>
である私はSystem.Threading.Thread.Sleep(10000);
を使用していますが、ページをゆっくりのでロードされている場合、それは動作しません、どのように私は、ページの読み込み時間を知ることができますか?別のブラウザでHtmlドキュメントのスクリーンショットを取得する別の方法はありますか?
ありがとうございます。
私はGoogleで検索するのに多くの時間を費やしていますが、解決策が見つかりません。私にちょっとしたアイデアを教えてくださいc#windowsアプリケーションからさまざまなブラウザ(Chrome、Mozilla、Ie、Opera)と通信します。助けてください。 –