public void AlertDialogSimpleJavaDialogHandler2()
        {
            SimpleJavaDialogHandler dialogHandler = new SimpleJavaDialogHandler();

            using (new UseDialogOnce(Ie.DialogWatcher, dialogHandler))
            {
                Ie.Button(Find.ByValue("Show alert dialog")).Click();

                Assert.AreEqual("This is an alert!", dialogHandler.Message, "Unexpected message");
            }
        }
        public void IEUseOnceDialogHandler()
        {
            Assert.AreEqual(0, Ie.DialogWatcher.Count, "DialogWatcher count should be zero");

            SimpleJavaDialogHandler dialogHandler = new SimpleJavaDialogHandler();

            using (new UseDialogOnce(Ie.DialogWatcher, dialogHandler))
            {
                Ie.Button(Find.ByValue("Show alert dialog")).Click();

                Assert.IsTrue(dialogHandler.HasHandledDialog, "Alert Dialog should be handled.");
                Assert.AreEqual("This is an alert!", dialogHandler.Message, "Unexpected message");
            }
        }
        public void ConfirmDialogSimpleJavaDialogHandlerCancel()
        {
            Assert.AreEqual(0, Ie.DialogWatcher.Count, "DialogWatcher count should be zero");

            SimpleJavaDialogHandler dialogHandler = new SimpleJavaDialogHandler(true);

            using (new UseDialogOnce(Ie.DialogWatcher, dialogHandler))
            {
                Ie.Button(Find.ByValue("Show confirm dialog")).Click();

                Assert.IsTrue(dialogHandler.HasHandledDialog, "Confirm Dialog should be handled.");
                Assert.AreEqual("Do you want to do xyz?", dialogHandler.Message);
                Assert.AreEqual("Cancel", Ie.TextField("ReportConfirmResult").Text, "Cancel button expected.");
            }
        }