abstractBrowseTheWeb <Native_Element_Type>
Hierarchy
- Ability
- BrowseTheWeb
Index
Constructors
Methods
Constructors
constructor
Type parameters
- Native_Element_Type = any
Parameters
session: BrowsingSession<Page<Native_Element_Type>>
Returns BrowseTheWeb<Native_Element_Type>
Methods
currentPage
allPages
Returns an array of pages representing all the browser tabs available in the current BrowsingSession.
Returns Promise<Page<Native_Element_Type>[]>
browserCapabilities
Returns basic meta-data about the browser associated with this ability.
Returns Promise<BrowserCapabilities>
The ability to
BrowseTheWeb
enables an actor to interact with and retrieve information from Web-based user interfaces.BrowseTheWeb
wraps test integration tools such as Playwright, Protractor, or WebdriverIO, and together with Serenity/JS Web models, such as Page or PageElement - offers a standardised way to write Web-based tests following the Screenplay Pattern.The consistent and portable design of abstractions provided by the
@serenity-js/web
module also helps to make your tests portable across the various test integration tools and helps to make your test code easier to reuse across projects and teams.Giving the actors an ability to
BrowseTheWeb
To give an actor an ability to
BrowseTheWeb
, provide the integration tool-specific implementation via Actor.whoCan in Cast.prepare, or via Cast.where.Learn more
To learn more about using Serenity/JS with your chosen test integration tool, follow their respective documentation:
Using the ability to
BrowseTheWeb
To use the ability to
BrowseTheWeb
in a custom Interaction or Question, use the generic method BrowseTheWeb.as to retrieve it.This generic method retrieves the integration tool-specific implementation of BrowseTheWeb present on the Actor, such as BrowseTheWebWithPlaywright or BrowseTheWebWethWebdriverIO, using Actor.abilityTo.
This decoupling mechanism helps to make your test code portable across test integration tools, since the only part of your test suite that needs to know about the test integration tool used are the actors. The rest of your test code, so tasks, interactions, and questions, remain fully agnostic of the underlying tool.
Pro tip: Use the specific
BrowseTheWebWith<test integration tool name>
to give the actor the ability, and genericBrowseTheWeb.as(actor)
to retrieve it.Learn more