Internet explorer 运行WatiN时隐藏Internet Explorer

Internet explorer 运行WatiN时隐藏Internet Explorer,internet-explorer,watin,Internet Explorer,Watin,我想知道如何防止每次运行控制台应用程序(使用WatiN测试实时站点)时Internet Explorer启动 当我运行我的控制台应用程序时,它会启动InternetExplore并运行我使用WatiN创建的所有测试 我想让我的控制台应用程序使用WatiN运行这些测试,但不显示Internet Explorer启动并出现在屏幕上 我基本上希望在运行测试时不会看到Internet Explorer。试试: using (IE ie = new IE("http://somesite.com/"))

我想知道如何防止每次运行控制台应用程序(使用WatiN测试实时站点)时Internet Explorer启动

当我运行我的控制台应用程序时,它会启动InternetExplore并运行我使用WatiN创建的所有测试

我想让我的控制台应用程序使用WatiN运行这些测试,但不显示Internet Explorer启动并出现在屏幕上

我基本上希望在运行测试时不会看到Internet Explorer。

试试:

using (IE ie = new IE("http://somesite.com/"))
{
  ie.ShowWindow(NativeMethods.WindowShowStyle.Hide);
  ....
}

Deafolt的IE类为一些特性使用了一些内置设置。其中之一是使NewieInstanceVisible。默认情况下,它设置为true。因此,您可以在创建IE类的新实例之前更改WatiN设置

Settings.Instance.MakeNewIeInstanceVisible = false;
browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Hide);