private string FindKeys(SeleniumCommandModel sender) { var teclas = new StringBuilder(); if (sender.Value.ContainsText("${KEY_ENTER}")) { teclas.Append(Keys.Enter); } return(teclas.ToString()); }
private StringBuilder CreateMessage(SeleniumCommandModel sender) { var message = new StringBuilder(); message.Append("Could not find component: "); message.Append(sender.Targets.FirstOrDefault()); if (!string.IsNullOrEmpty(sender.Comment)) { message.AppendLine(); message.Append(sender.Comment); } return(message); }
protected IWebElement SearchElement(SeleniumCommandModel sender) { foreach (var target in sender.Targets) { if (TryGetTargetElement(target, out IWebElement element) && (element != null)) { return(element); } } if (!string.IsNullOrEmpty(sender.Target)) { var target = CreateTarget(sender.Target); if ((target != null) && TryGetTargetElement(target, out IWebElement element) && (element != null)) { return(element); } } var message = CreateMessage(sender); throw new Exception(message.ToString()); }
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { var element = SearchElement(comand); element .Should() .NotBeNull(); var preventDefault = false; var customEvent = GetCustomEvent <SendKeysCommandDelegate>(); var value = FindKeys(comand); customEvent?.Invoke(tests, test, comand, element, ref value, ref preventDefault); if (!preventDefault) { element.SendKeys(value); } }
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { var element = SearchElement(comand); element .Should() .NotBeNull(); element.Clear(); }
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { Current.Driver.Close(); }
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { var size = comand.Target.Split('x'); if (size.Length > 1) { Current.Driver.Manage().Window.Size = new Size(size[0].ToInt(), size[1].ToInt()); } }
public abstract void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand);
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { var alert = Current.Driver.SwitchTo().Alert(); alert .Should() .NotBeNull(); Current.LastAlert = alert.Text; alert.Dismiss(); }
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { }
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { Wait(1000 * 2); if (!comand.Target.ContainsText("=")) { return; } var index = comand.Target.Split('=')[1].ToInt(); Current.Driver.SwitchTo().Frame(frameIndex: index); }
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { var element = SearchElement(comand); element .Should() .NotBeNull(); var preventDefault = false; var customEvent = GetCustomEvent <DoubleClickCommandDelegate>(); customEvent?.Invoke(tests, test, comand, element, ref preventDefault); if (!preventDefault) { Current.Actions.DoubleClick(element).Perform(); } }
private void PerformCommand(SeleniumSideModel tests, Context context, SeleniumTestModel test, SeleniumCommandModel command) { var current = CommandFactory.Create(context, command.Command); if (!(current is INextCommand)) { current.Perform(tests, test, command); } if (context.LastCommand is INextCommand) { context.LastCommand.Perform(tests, test, command); } context.LastCommand = current; }
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { Current.LastAlert .Should() .NotBeNull(); Current.LastAlert .Should() .Be(comand.Target); }
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { var element = SearchElement(comand); element .Should() .NotBeNull(); Current.Actions.MoveToElement(element).Perform(); }
public override void Perform(SeleniumSideModel tests, SeleniumTestModel test, SeleniumCommandModel comand) { Current.Driver.Navigate().GoToUrl(tests.Url + comand.Target); }