Skip to main content

Scroll

Instructs an actor who has the ability to BrowseTheWeb to scroll until a given PageElement comes into view.

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, PageElement } from '@serenity-js/web'

class Form {
static submitButton = () => {
PageElement.located(By.id('submit'))
.describedAs('submit button')
}

Scrolling to element

import { actorCalled } from '@serenity-js/core'
import { Ensure } from '@serenity-js/assertions'
import { Scroll, isVisible } from '@serenity-js/web'

await actorCalled('Sara')
.attemptsTo(
Scroll.to(Form.submitButton()),
Ensure.that(Form.submitButton(), isVisible()),
)

Learn more

Hierarchy

  • Interaction
    • Scroll

Index

Methods

staticto

instantiationLocation

  • instantiationLocation(): FileSystemLocation
  • Returns the location where this Activity was instantiated.


    Returns FileSystemLocation

toString

  • toString(): string
  • Generates a human-friendly description to be used when reporting this Activity.

    Note: When this activity is reported, token #actor in the description will be replaced with the name of the actor performing this Activity.

    For example, #actor clicks on a button becomes Wendy clicks on a button.


    Returns string

performAs

  • performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>
  • @inheritDoc

    Parameters

    • actor: UsesAbilities & AnswersQuestions

    Returns Promise<void>