OpenQA.Selenium.WindowSwitchingTest.ShouldGetBrowserHandles C# (CSharp) Méthode

ShouldGetBrowserHandles() private méthode

private ShouldGetBrowserHandles ( ) : void
Résultat void
        public void ShouldGetBrowserHandles()
        {
            driver.Url = xhtmlTestPage;
            driver.FindElement(By.LinkText("Open new window")).Click();

            string handle1, handle2;
            handle1 = driver.GetWindowHandle();

            driver.SwitchTo().Window("result");
            handle2 = driver.GetWindowHandle();

            ReadOnlyCollection<string> handles = driver.GetWindowHandles();

            // At least the two handles we want should be there.
            Assert.Contains(handle1, handles, "Should have contained current handle");
            Assert.Contains(handle2, handles, "Should have contained result handle");

            // Some (semi-)clean up..
            driver.Url = macbethPage;
            driver.SwitchTo().Window(handle1);
        }