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

FailingToSwitchToAWindowLeavesTheCurrentWindowAsIs() private méthode

private FailingToSwitchToAWindowLeavesTheCurrentWindowAsIs ( ) : void
Résultat void
        public void FailingToSwitchToAWindowLeavesTheCurrentWindowAsIs()
        {
            driver.Url = xhtmlTestPage;
            String current = driver.GetWindowHandle();

            try
            {
                driver.SwitchTo().Window("i will never exist");
                Assert.Fail("Should not be ablt to change to a non-existant window");
            }
            catch (NoSuchWindowException)
            {
                // expected
            }

            String newHandle = driver.GetWindowHandle();

            Assert.AreEqual(current, newHandle);
        }