English 中文(简体)
如何将Html文件放在不同的浏览器中,作为Html文件被完全删除的形象?
原标题:How to get the Html Document in different browser, as an image when Html Document is Loaded completely?

I have a problem on taking the snapshot of html document running on different browsers. I want to take snapshots of the web page running in different browser (Chrome,Fire Fox,ie etc) for browser comp ability test but i am getting the problem with html document loading time and here is my code,

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

页: 1

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="Chrome" value="C:Documents and SettingsubaLocal SettingsApplication DataGoogleChromeApplicationchrome.exe"/>
    <add key="Firefox" value="C:Program FilesMozilla Firefoxfirefox.exe"/>
    <add key="Safari" value="C:Program FilesSafariSafari.exe"/>
    <add key="Ie" value="C:Program FilesInternet ExplorerIEXPLORE.EXE"/>
    <add key="Opera" value="C:Program FilesOperaopera.exe"/>
  </appSettings>
</configuration>

这里,一是使用<代码>System.Threading.Thread.Sleep (10000);,但如果页数缓慢装满,则能知道页数时间? 是否有另一种方式在不同的Browser对Html文件进行筛查?

提前感谢。

最佳回答

Thank you Michael and Chad.I am not able to find out the way to communicate with web browsers from win application,so i am finally using Selenium-RC to take the screen shot of a web page in my project and here is the documentation url :http://seleniumhq.org/docs/05_selenium_rc.html

问题回答

我不知道你可以与这些不同行凶者进行沟通的“标准”方式,他们各自使用自己的促销工具,尽管他们各自也执行类似的特征,但不愿意自行做事。

关于与互联网探索者窗口进行互动的简单方式,见,该条

至于确定该网页上装上火灾fox和谷歌 Chrome时,I m与你一样,也是从我能够告诉的那位其他人一样(通过几个href=





相关问题
Bring window to foreground after Mutex fails

I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...

How to start WinForm app minimized to tray?

I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

Handle DataTable.DataRow cell change event

I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?

Apparent Memory Leak in DataGridView

How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

WPF-XAML window in Winforms Application

I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.

热门标签