public static string lastAlert(this AlertAndConfirmDialogHandler alertHandler)
 {
     if (alertHandler.notNull() &&
         alertHandler.alerts().notNull() &&
         alertHandler.alerts().size() > 0)
     {
         return(alertHandler.alerts().last());
     }
     return("");
 }
        public void MissingAlertExceptionTest()
        {
            Assert.AreEqual(0, Ie.DialogWatcher.Count, "DialogWatcher count should be zero before test");

            var dialogHandler = new AlertAndConfirmDialogHandler();

            using (new UseDialogOnce(Ie.DialogWatcher, dialogHandler))
            {
                dialogHandler.Pop();
            }
        }
        public Unit_Tests_API_WordPress_IE()
        {
            base.set_IE_Object("Unit_Tests_API_WordPress_IE");
            alertsHander = ie.getAlertsHandler();
            var serverUrl = "https://o2platform.wordpress.com".uri();

            apiWordPressIE = new API_WordPress_IE(ie, serverUrl);

            base.CLOSE_BROWSER_IN_SECONDS = 0;
            //base.minimized();
        }
        public static AlertAndConfirmDialogHandler getAlertsHandler(this WatiN_IE watinIe)
        {
            var alertHandler = watinIe.dialogHandler <AlertAndConfirmDialogHandler>();

            if (alertHandler.isNull())
            {
                alertHandler = new AlertAndConfirmDialogHandler();
                watinIe.IE.AddDialogHandler(alertHandler);
            }
            return(alertHandler);
        }
        public void AlertAndConfirmDialogHandler()
        {
            DialogWatcher dialogWatcher;

            Assert.AreEqual(0, Ie.DialogWatcher.Count, "DialogWatcher count should be zero before test");

            // Create handler for Alert and confirm dialogs and register it.
            var dialogHandler = new AlertAndConfirmDialogHandler();

            using (new UseDialogOnce(Ie.DialogWatcher, dialogHandler))
            {
                Assert.AreEqual(0, dialogHandler.Count);

                Ie.Button("helloid").Click();

                Assert.AreEqual(1, dialogHandler.Count);
                Assert.AreEqual("hello", dialogHandler.Alerts[0]);

                // getting alert text
                Assert.AreEqual("hello", dialogHandler.Pop());

                Assert.AreEqual(0, dialogHandler.Count);

                // Test Clear
                Ie.Button("helloid").Click();

                Assert.AreEqual(1, dialogHandler.Count);

                dialogHandler.Clear();

                Assert.AreEqual(0, dialogHandler.Count);

                dialogWatcher = Ie.DialogWatcher;
            }

            Assert.AreEqual(0, dialogWatcher.Count, "DialogWatcher count should be zero after test");
        }
 public static List <string> alerts(this AlertAndConfirmDialogHandler alertHandler)
 {
     return(alertHandler.Alerts.toList());
 }
 public static AlertAndConfirmDialogHandler reset(this AlertAndConfirmDialogHandler alertHandler)
 {
     alertHandler.Clear();
     return(alertHandler);
 }