Scroll
Instructs the Actor to scroll until a given Web element comes into view.
Extends:
Interaction → Scroll
Examples:
Example widget
<!--
an element somewhere at the bottom of the page,
outside of the visible area
-->
<input type="submit" id="submit" />
Lean Page Object describing the widget
import { by, Target } from '@serenity-js/webdriverio';
class Form {
static submitButton = Target.the('submit button')
.located(by.id('submit'));
}
Scrolling to element
import { actorCalled } from '@serenity-js/core';
import { Ensure } from '@serenity-js/assertions';
import { BrowseTheWeb, Scroll, isVisible } from '@serenity-js/webdriverio';
actorCalled('Sara')
.whoCan(BrowseTheWeb.using(browser))
.attemptsTo(
Scroll.to(Form.submitButton),
Ensure.that(Form.submitButton, isVisible()),
);
Tests:
See also:
Static Method Summary
Static Public Methods | ||
public static |
to(target: Answerable<Element<'async'>>): Interaction Instantiates this Interaction. |
Constructor Summary
Public Constructor | ||
public |
constructor(target: Answerable<Element<'async'>>) |
Method Summary
Public Methods | ||
public |
async performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void> Makes the provided Actor perform this Interaction. |
Static Public Methods
public static to(target: Answerable<Element<'async'>>): Interaction source
Instantiates this Interaction.
Params:
Name | Type | Attribute | Description |
target | Answerable<Element<'async'>> | The element to be scrolled to |
Public Constructors
Public Methods
public async performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void> source
Makes the provided Actor perform this Interaction.
Params:
Name | Type | Attribute | Description |
actor | UsesAbilities & AnswersQuestions | An Actor to perform this Interaction |
Returns:
PromiseLike<void> |