Skip to main content

BrowseTheWebWithWebdriverIO

This implementation of the ability to BrowseTheWeb enables the Actor to interact with web front-ends using WebdriverIO.

Using WebdriverIO to BrowseTheWeb

import { actorCalled } from '@serenity-js/core'
import { BrowseTheWebWithWebdriverIO } from '@serenity-js/webdriverio'
import { By, Navigate, PageElement, Text } from '@serenity-js/web'
import { Ensure, equals } from '@serenity-js/assertions'
import { browser } from '@wdio/globals'

const HomePage = {
title: () =>
PageElement.located(By.css('h1')).describedAs('title')
}

await actorCalled('Wendy')
.whoCan(BrowseTheWebWithWebdriverIO.using(browser)) // `browser` is global in WebdriverIO tests
.attemptsTo(
Navigate.to(`https://serenity-js.org`),
Ensure.that(Text.of(HomePage.title()), equals('Serenity/JS')),
);

Learn more

Hierarchy

  • BrowseTheWeb<WebdriverIO.Element>
    • BrowseTheWebWithWebdriverIO

Index

Constructors

constructor

  • Parameters

    • session: BrowsingSession<Page<Element>>

    Returns BrowseTheWebWithWebdriverIO

Methods

staticusing

currentPage

  • currentPage(): Promise<Page<Element>>
  • Returns a Page representing the currently active browser tab.


    Returns Promise<Page<Element>>

allPages

  • allPages(): Promise<Page<Element>[]>
  • Returns an array of pages representing all the browser tabs available in the current BrowsingSession.


    Returns Promise<Page<Element>[]>

browserCapabilities

  • browserCapabilities(): Promise<BrowserCapabilities>
  • Returns basic meta-data about the browser associated with this ability.


    Returns Promise<BrowserCapabilities>