运行WatiN时隐藏Internet Explorer

13 internet-explorer watin

我想知道每次运行使用WatiN测试实时网站的控制台应用程序时,我是如何阻止Internet Explorer启动的.

当我运行我的控制台应用程序时,它会激活Internet探索并运行我使用WatiN创建的所有测试.

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

我基本上希望测试在没有看到Internet Explorer的情况下运行.

小智 25

deafult的IE类使用一些内置设置来实现一些功能.其中一个是MakeNewIeInstanveVisible.默认情况下,它设置为true.因此,您可以在创建IE类的新实例之前更改WatiN设置.

Settings.Instance.MakeNewIeInstanceVisible = false;
Run Code Online (Sandbox Code Playgroud)


Mar*_*ark 5

尝试:

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