/// <summary> /// Look in the active Alert/Prompt for the specified text. If the text does not match the prompt will be cleanly exited to allow clean failure or continuation of the test. /// </summary> /// <param name="accessor"></param> public AssertSyntaxProvider In(Alert accessor) { if (accessor != Alert.Message) throw new FluentException("FluentAutomation only supports checking the message in an alerts or prompts."); if (this.matchFunc == null) { if (this.notMode) this.assertProvider.AlertNotText(this.text); else this.assertProvider.AlertText(this.text); } else { if (this.notMode) this.assertProvider.AlertNotText(this.matchFunc); else this.assertProvider.AlertText(this.matchFunc); } return this.assertSyntaxProvider; }
/// <summary> /// Look in the active Alert/Prompt for the specified value. /// </summary> /// <param name="accessor"></param> public AssertSyntaxProvider In(Alert accessor) { if (accessor != Alert.Message) { this.commandProvider.AlertClick(Alert.Cancel); throw new FluentException("FluentAutomation only supports checking the message in an alerts or prompts."); } if (this.matchFunc == null) { if (this.notMode) this.assertProvider.AlertNotText(this.value.ToString()); else this.assertProvider.AlertText(this.value.ToString()); } else { if (this.notMode) this.assertProvider.AlertNotText(this.matchFunc); else this.assertProvider.AlertText(this.matchFunc); } return this.assertSyntaxProvider; }
/// <summary> /// Enter text into the active prompt /// </summary> /// <param name="accessor"></param> public IActionSyntaxProvider In(Alert accessor) { if (accessor.Field != AlertField.Input) { this.syntaxProvider.commandProvider.AlertClick(Alert.Cancel); throw new FluentException("FluentAutomation only supports entering text in text input of a prompt."); } this.syntaxProvider.commandProvider.AlertEnterText(text); return this.syntaxProvider; }
public IActionSyntaxProvider Click(Alert alertAccessor) { if (alertAccessor.Field != AlertField.OKButton && alertAccessor.Field != AlertField.CancelButton) { this.Click(Alert.Cancel); throw new FluentException("FluentAutomation only supports clicking the OK or Cancel buttons of an alert/prompt."); } this.commandProvider.AlertClick(alertAccessor); return this; }
public void AlertClick(Alert accessor) { this.RepackExceptions(() => Parallel.ForEach(this.commandProviders, x => x.AlertClick(accessor))); }
public void AlertClick(Alert accessor) { this.SetActiveAlert(); if (ActiveAlert == null) return; try { this.Act(CommandType.Action, () => { try { if (accessor == Alert.OK) ActiveAlert.Accept(); else ActiveAlert.Dismiss(); } catch (NoAlertPresentException ex) { throw new FluentException(ex.Message, ex); } }); } finally { ActiveAlert = null; } }
public void AlertClick(Alert accessor) { if (accessor.Field == AlertField.OKButton) { this.AlertHandler.WaitUntilExists((int)this.Settings.WaitTimeout.TotalSeconds); this.AlertHandler.OKButton.Click(); } else if (accessor.Field == AlertField.CancelButton) { this.ConfirmHandler.WaitUntilExists((int)this.Settings.WaitTimeout.TotalSeconds); this.ConfirmHandler.CancelButton.Click(); } else { // attempt to close any dialogs to allow other tests to continue try { this.AlertHandler.OKButton.Click(); } catch (Exception) { } try { this.ConfirmHandler.OKButton.Click(); } catch (Exception) { } throw new FluentException("FluentAutomation only supports clicking on OK or Cancel in alerts or prompts."); } }