다른 브라우저에서 실행중인 html 문서의 스냅 샷을 찍는 데 문제가 있습니다. 다른 브라우저 (Chrome, Fire Fox, ie 등)에서 실행중인 웹 페이지의 스냅 샷을 브라우저 압축 기능 테스트에 사용하고 싶지만 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)와 통신 할 수 있습니다.도와주세요. –