Example #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.AsksFor(JavaScriptElementCall.To($"arguments[0].scrollTop = {Top};", Locator));
     }
     if (Left != null)
     {
         actor.AsksFor(JavaScriptElementCall.To($"arguments[0].scrollLeft = {Left};", Locator));
     }
 }
 /// <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.AsksFor(JavaScriptElementCall.To("return arguments[0].textContent;", Locator)).ToString();
 /// <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.AsksFor(JavaScriptElementCall.To("arguments[0].click();", Locator));