Problem hiding Internet Explorer in WatiN, even when using Settings.Instance.MakeNewIeInstanceVisible = false

给你一囗甜甜゛ 提交于 2019-12-11 11:54:49

问题


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

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?

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

回答1:


You can Hide window after initializing new IE instance

browser.ShowWindow(NativeMethods.WindowShowStyle.Hide);



来源:https://stackoverflow.com/questions/3095837/problem-hiding-internet-explorer-in-watin-even-when-using-settings-instance-mak

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!