Skip to main content

Testplane Commands

Overview​

This reference covers Testplane v9 and commands from its WebdriverIO v9 dependency. Availability depends on the browser, session protocol and dependency version; each page lists its requirements. For older versions, use the documentation archive and WebdriverIO v8.

Testplane does not provide the WDIO runner's implicit global browser, $ and $$. Get browser from the test argument, or use this.browser in a regular function. An arrow function does not receive the test's this context. Find elements with browser.$ and browser.$$.

Example​

Both tests open / relative to baseUrl. The test page must contain an h1 with the text Command examples.

const assert = require("node:assert/strict");

it("commands: use the browser fixture", async ({ browser }) => {
await browser.url("/");
assert.equal(await browser.$("h1").getText(), "Command examples");
});

it("commands: use this.browser with a regular function", async function () {
await this.browser.url("/");
assert.equal(await this.browser.$("h1").getText(), "Command examples");
});

Choose a command​

TaskCommands
Page setup and emulationaddInitScript, emulate, restore, setViewport
Custom selectorsaddLocatorStrategy, browser.custom$, browser.custom$$, element.custom$, element.custom$$
Frames and downloadsswitchFrame, downloadFile
Resource throttlingthrottleCPU, throttleNetwork
Element operationsexecute, executeAsync, getElement, isStable, waitForStable
Network interceptionmock, waitForResponse, request, requestOnce, redirect, redirectOnce, reset
Testplane extensionsextendOptions, browser.unstable_captureDomSnapshot, element.unstable_captureDomSnapshot, unstable_getCdp

Reference scope​

Low-level WebDriver, BiDi and Appium commands are not duplicated here: see WebdriverIO protocols. Methods of InitScript and clock objects are documented with addInitScript and emulate, not as separate browser commands. When using external recipes, account for version differences and how Testplane provides browser.