我想关闭“浏览器”类型的子窗口。看看下面的代码。
WatiN.Core.Browser openBrowser = BrowserType.getBrowserObject()。attachChildBrowser(document_name + Constants.open_document_title);
我想关闭“openBrowser”。 Close()(在WatiN中可用)只能用于“Firefox”的“IE”类型。所以,我也不能使用Close()方法。有没有办法在C#或WatiN中关闭浏览器?
答案 0 :(得分:2)
您是否尝试过使用IE类型而不是浏览器类型?你可以尝试这样的事情:
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();