Exemplo n.º 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));
     }
 }
Exemplo n.º 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.AsksFor(JavaScriptElementCall.To("return arguments[0].textContent;", Locator)).ToString();
Exemplo n.º 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.AsksFor(JavaScriptElementCall.To("arguments[0].click();", Locator));