예제 #1
0
 /// <summary>
 /// Scrolls directly to an element using JavaScript.
 /// </summary>
 /// <param name="actor">The Screenplay Actor.</param>
 /// <param name="driver">The WebDriver.</param>
 public override void PerformAs(IActor actor, IWebDriver driver)
 {
     if (Top != null)
     {
         actor.Calls(JavaScript.On(Locator, $"arguments[0].scrollTop = {Top};"));
     }
     if (Left != null)
     {
         actor.Calls(JavaScript.On(Locator, $"arguments[0].scrollLeft = {Left};"));
     }
 }
예제 #2
0
 /// <summary>
 /// Gets a web element's JavaScript textContent value.
 /// </summary>
 /// <param name="actor">The actor.</param>
 /// <param name="driver">The WebDriver.</param>
 /// <returns></returns>
 public override string RequestAs(IActor actor, IWebDriver driver) =>
 actor.Calls(JavaScript <string> .On(Locator, "return arguments[0].textContent;")).ToString();
예제 #3
0
 /// <summary>
 /// Clicks the web element.
 /// Use browser actions instead of direct click (due to IE).
 /// </summary>
 /// <param name="actor">The Screenplay Actor.</param>
 /// <param name="driver">The WebDriver.</param>
 public override void PerformAs(IActor actor, IWebDriver driver) =>
 actor.Calls(JavaScript.On(Locator, "arguments[0].click();"));