OpenQA.Selenium.AlertsTest.ShouldThrowAnExceptionIfAnAlertHasNotBeenDealtWith C# (CSharp) 메소드

ShouldThrowAnExceptionIfAnAlertHasNotBeenDealtWith() 개인적인 메소드

        public void ShouldThrowAnExceptionIfAnAlertHasNotBeenDealtWith()
        {
            driver.Url = alertsPage;

            driver.FindElement(By.Id("alert")).Click();

            IAlert alert = driver.SwitchTo().Alert();
            try
            {
                string title = driver.Title;
            }
            catch (InvalidOperationException)
            {
                // this is an expected exception
            }

            // but the next call should be good.
            Assert.AreEqual("Testing Alerts", driver.Title);
        }