This package has been deprecated

Author message:

Please use @pageobject/flexible-selenium instead.

@pageobject/standard-selenium
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-beta-4 • Public • Published

@pageobject/standard-selenium Package Version Build Status Coverage Status

This package implements the PageObjectJS standard API for Selenium.

Installation

yarn add @pageobject/standard-selenium

Peer dependencies

yarn add @pageobject/standard \
         selenium-webdriver

TypeScript types

yarn add --dev @types/selenium-webdriver

API

Please find the API documentation here.

Usage

In this example we load the website example.com and test if the actual page title corresponds to the expected page title.

The complete code of this example can be found in the file example.js.

Create a new Selenium WebDriver instance

const driver = await new Builder()
  .withCapabilities({
    browserName: 'chrome',
    chromeOptions: {args: ['headless', 'disable-gpu']}
  })
  .build();

Please make sure you have the latest version of Chrome installed.

Additionally a suitable ChromeDriver is required, in this example we use node-chromedriver to install it.

require('chromedriver');

Load the website

const page = await SeleniumPage.load('http://example.com/', driver);

Create a page object

class Root extends StandardPageObject {
  get selector() {
    return ':root';
  }
}

const root = new Root(page);

Run the assertion using the page object

assert.strictEqual(await root.getPageTitle(), 'Example Domain');

Built by (c) Clemens Akens. Released under the terms of the MIT License.

/@pageobject/standard-selenium/

    Package Sidebar

    Install

    npm i @pageobject/standard-selenium

    Weekly Downloads

    0

    Version

    1.0.0-beta-4

    License

    MIT

    Unpacked Size

    11.8 kB

    Total Files

    10

    Last publish

    Collaborators

    • clebert