Beispiel #1
0
        public void Enumerate_Windows_Popup()
        {
            Helper.RunDefaultBrowser();
            Helper.LoadTestFile("page_opens_several_tabs.html");

            Helper.ClickId("openTab2");
            Helper.ClickId("openTab3");
            Helper.ClickId("openJavaScriptPopup");


            BrowserWindow[] actualWindows = WebSpyBrowser.GetBrowserWindows();

            string[] expectedWindowTitles = new string[]
            {
                "Page Tab1",
                "JavaScript Popup",
                "Page Tab3",
                "Page Tab2"
            };

            string[] actualTitles = actualWindows.Select(w => w.Title).ToArray();

            actualTitles.Should().Contain(expectedWindowTitles);

            WebSpyBrowser.CloseDriver();
        }
        public void RefreshWindowsList()
        {
            Exception outException;
            bool      isOk = false;

            isOk = UIActions.PerformSlowOperation(
                "Operation: Refresh All Windows List",
                () =>
            {
                BrowserWindow[] currentWindows = WebSpyBrowser.GetBrowserWindows();
                string currentWindowHandle     = WebSpyBrowser.GetCurrentWindowHandle();
                view.UpdateBrowserWindowsList(currentWindows, currentWindowHandle);
            },
                out outException,
                null,
                TimeSpan.FromMinutes(1)
                );

            if (!isOk)
            {
                MyLog.Error("Failed to refresh All Windows List");
                if (outException != null)
                {
                    throw outException;
                }
            }
        }