public void TestMultipleIE() { using (var ie = new IE(TestEventsURI)) { var handler = new ConfirmDialogHandler(); try { ie.AddDialogHandler(handler); ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait(); handler.WaitUntilExists(5); handler.OKButton.Click(); } finally { ie.RemoveDialogHandler(handler); } using (var ie2 = new IE(TestEventsURI)) { var handler2 = new ConfirmDialogHandler(); try { ie2.AddDialogHandler(handler2); ie2.Button(Find.ByValue("Show confirm dialog")).ClickNoWait(); handler2.WaitUntilExists(5); handler2.OKButton.Click(); } finally { ie2.RemoveDialogHandler(handler2); } } } }
public void ClickOk() { var handler = new ConfirmDialogHandler(); using (new UseDialogOnce(_browser.DialogWatcher, handler)) { _action(); handler.WaitUntilExists(); handler.OKButton.Click(); _browser.WaitForComplete(); } }
public void Should_also_handle_dialog_when_more_then_one_browser_is_open() { var not_used_ie = new IE(); var approveConfirmDialog = new ConfirmDialogHandler(); using (new UseDialogOnce(Ie.DialogWatcher, approveConfirmDialog)) { Ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait(); approveConfirmDialog.WaitUntilExists(5); approveConfirmDialog.OKButton.Click(); } Ie.WaitForComplete(); }
public void Bug_1958882_SelectNoWait_is_waiting_somewhere() { Ie.GoTo(TestEventsURI); var confirm = new ConfirmDialogHandler(); using (new UseDialogOnce(Ie.DialogWatcher, confirm)) { Ie.SelectList(Find.ById("selectList")).Option(Find.ByValue("2")).SelectNoWait(); confirm.WaitUntilExists(); confirm.OKButton.Click(); } }
public void WhenIClickDeleteInTheUserTableAndConfirmTheDeletion(string displayName) { Thread.Sleep(1500); UserPage.AllDisplayLink.ClickNoWait(); Thread.Sleep(1000); var dialog = new ConfirmDialogHandler(); using (new UseDialogOnce(IEInstance.DialogWatcher, dialog)) { UserPage.GetUserDeleteButton(displayName).ClickNoWait(); dialog.WaitUntilExists(); dialog.OKButton.Click(); } Thread.Sleep(1500); }
public void ThenIDeleteTheLanguage(string languageName) { LanguagePage.GetCheckBoxForLanguage(languageName).Click(); IEInstance.WaitForComplete(); LanguagePage.GetEditLanguageButtonForLanguage(languageName).Click(); IEInstance.WaitForComplete(); LanguagePage.GetEditLanguageButtonForLanguage(languageName).Click(); IEInstance.WaitForComplete(); var dialog = new ConfirmDialogHandler(); using (new UseDialogOnce(IEInstance.DialogWatcher, dialog)) { LanguagePage.DeleteLanguageLink.ClickNoWait(); dialog.WaitUntilExists(); dialog.OKButton.Click(); } }
public void WhenMovingTheFileFromFolder1ToFolder2() { SelectTreeNode("folder1"); var checkbox = FileManagerPage.FolderContentsTable.Span(Find.BySelector("[filename=\"Do Change.doc\"]")) .CheckBox(Find.ById(new Regex(@".*dgFileList_ctl(\d*)_chkFile.*", RegexOptions.IgnoreCase))); checkbox.Checked = true; var dialog = new ConfirmDialogHandler(); using (new UseDialogOnce(IEInstance.DialogWatcher, dialog)) { FileManagerPage.MoveFileImage.ClickNoWait(); dialog.WaitUntilExists(); dialog.OKButton.Click(); } SelectTreeNode("folder2"); FileManagerPage.MoveFileOKButton.Click(); }
public void ConfirmDialogHandlerCancel() { Assert.AreEqual(0, Ie.DialogWatcher.Count, "DialogWatcher count should be zero"); ConfirmDialogHandler confirmDialogHandler = new ConfirmDialogHandler(); using (new UseDialogOnce(Ie.DialogWatcher, confirmDialogHandler)) { Ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait(); confirmDialogHandler.WaitUntilExists(); string message = confirmDialogHandler.Message; confirmDialogHandler.CancelButton.Click(); Ie.WaitForComplete(); Assert.AreEqual("Do you want to do xyz?", message, "Unexpected message"); Assert.AreEqual("Cancel", Ie.TextField("ReportConfirmResult").Text, "Cancel button expected."); } }
public void WhenISubmitContentOfModule0(int moduleId) { ModulePage.GetEditModuleContentLink(moduleId).Click(); if (!HTMLModule.PublishCheckBox.Enabled) { var dialog = new ConfirmDialogHandler(); using (new UseDialogOnce(IEInstance.DialogWatcher, dialog)) { HTMLModule.SaveContentLink.Click(); dialog.WaitUntilExists(); dialog.OKButton.Click(); } ModulePage.GetEditModuleContentLink(moduleId).Click(); } HTMLModule.PublishCheckBox.Checked = true; HTMLModule.SaveContentLink.Click(); HTMLModule.CommentTextField.Value = "Submit Comment"; HTMLModule.AddCommentLink.Click(); WaitAjaxRequestComplete(); }
public void TestMultipleIEInstancesOpeningAlertDialogs() { using (var ie = new IE(TestEventsURI)) { var handler = new ConfirmDialogHandler(); using (new UseDialogOnce(ie.DialogWatcher, handler)) { ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait(); handler.WaitUntilExists(5); using (var ie2 = new IE(TestEventsURI)) { var handler2 = new ConfirmDialogHandler(); using (new UseDialogOnce(ie2.DialogWatcher, handler2)) { ie2.Button(Find.ByValue("Show confirm dialog")).ClickNoWait(); handler2.WaitUntilExists(5); handler2.OKButton.Click(); } } handler.OKButton.Click(); } } }
private static string RunControlConfirm(List <HControl> controls, IE ie) { int i = 0; string status = "Error"; while (i < Loop) { i++; foreach (HControl control in controls) { switch (control.Control.ToLower()) { case ControlType.AHref: { WatiN.Core.Link obj = MyWatiN.GetLink(ie, control); if (obj != null) { ConfirmDialogHandler approveConfirmDialog = new ConfirmDialogHandler(); using (new UseDialogOnce(ie.DialogWatcher, approveConfirmDialog)) { obj.ClickNoWait(); approveConfirmDialog.WaitUntilExists(); approveConfirmDialog.OKButton.Click(); ie.WaitForComplete(); return(String.Empty); } } break; } case ControlType.Link: { WatiN.Core.Link obj = MyWatiN.GetLink(ie, control); if (obj != null) { ConfirmDialogHandler approveConfirmDialog = new ConfirmDialogHandler(); using (new UseDialogOnce(ie.DialogWatcher, approveConfirmDialog)) { obj.ClickNoWait(); approveConfirmDialog.WaitUntilExists(); approveConfirmDialog.OKButton.Click(); ie.WaitForComplete(); return(String.Empty); } } break; } case ControlType.Button: { WatiN.Core.Button obj = MyWatiN.GetButton(ie, control); if (obj != null) { ConfirmDialogHandler approveConfirmDialog = new ConfirmDialogHandler(); using (new UseDialogOnce(ie.DialogWatcher, approveConfirmDialog)) { obj.ClickNoWait(); approveConfirmDialog.WaitUntilExists(); approveConfirmDialog.OKButton.Click(); ie.WaitForComplete(); return(String.Empty); } } break; } case ControlType.Div: { WatiN.Core.Div obj = MyWatiN.GetDiv(ie, control); if (obj != null) { ConfirmDialogHandler approveConfirmDialog = new ConfirmDialogHandler(); using (new UseDialogOnce(ie.DialogWatcher, approveConfirmDialog)) { obj.ClickNoWait(); approveConfirmDialog.WaitUntilExists(); approveConfirmDialog.OKButton.Click(); ie.WaitForComplete(); return(String.Empty); } } break; } } } Thread.Sleep(1000); } return(status); }