即使在使用Settings.Instance.MakeNewIeInstanceVisible = false时,也无法在WatiN中隐藏Internet Explorer [英] Problem hiding Internet Explorer in WatiN, even when using Settings.Instance.MakeNewIeInstanceVisible = false

查看:74
本文介绍了即使在使用Settings.Instance.MakeNewIeInstanceVisible = false时,也无法在WatiN中隐藏Internet Explorer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题更像是对这个问题的后续行动: 在运行WatiN时隐藏Internet Explorer

This question is more of a follow-up to this one: Hiding Internet Explorer when WatiN is run

就像问那个原始问题的人一样,我也想在我的WatiN测试运行时停止显示IE,但是即使以一种看似正确的方式使用此设置(下面的代码段),它仍然会最终显示最初是一个空的IE窗口(尽管它不显示测试行为/网页交互).

Like the person who asked that original question, I also want to stop IE from being shown when my WatiN tests are running, but even when using this setting in a seemingly correct manner (code snippet below), it still ends up showing an empty IE window initially (although it does not show the test behavior/web page interaction).

是否有可能完全停止显示窗口,或者它是否尽其所能?

Is it possible to stop the window from showing at all, or is this as good as it gets?

创建新IE实例的帮助方法:

My helper method to create a new IE instance:

public static IE CreateNewBrowserInstance(string url = DefaultAppUrl)
    {
        Settings.Instance.MakeNewIeInstanceVisible = false;
        Settings.Instance.AutoMoveMousePointerToTopLeft = false;
        Settings.Instance.AutoStartDialogWatcher = false;

        return new IE(url, true);
    }

推荐答案

您可以在初始化新的IE实例后隐藏窗口

You can Hide window after initializing new IE instance

browser.ShowWindow(NativeMethods.WindowShowStyle.Hide);

browser.ShowWindow(NativeMethods.WindowShowStyle.Hide);

这篇关于即使在使用Settings.Instance.MakeNewIeInstanceVisible = false时,也无法在WatiN中隐藏Internet Explorer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆