开发者

how to close a child browser in c# or WatiN?

开发者 https://www.devze.com 2022-12-24 21:04 出处:网络
I want to close the child window which is of \"Browser\" type.Have a look at the below code. WatiN.Core.Browser openBrowser = BrowserType.getBrowserObject().attachChildBrowser(document_name + Constan

I want to close the child window which is of "Browser" type. Have a look at the below code.

WatiN.Core.Browser openBrowser = BrowserType.getBrowserObject().attachChildBrowser(document_name + Constants.open_docum开发者_开发知识库ent_title);

I want to close the "openBrowser". Close()(available in WatiN) can only be used for the type "IE" of "Firefox" only. So, I cant use Close() method also. Is there any method to close the browser in C# or WatiN?


Have you tried using the IE type instead of the browser type? You could try something like this:

System.Threading.Thread.Sleep(5000);
IE popUpWindow = IE.AttachTo<IE>.Find.ByUrl(s=>s.StartsWith("http://www.google.com")));
Assert.IsTrue(popUpWindow.Title.Contains("google - Google Search"));
popUpWindow.Close();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号