Skip to main content

waitForClickable

Overview

Use the waitForClickable command to wait until an element becomes clickable or unclickable within a specified number of milliseconds.

warning

Unlike other element commands, Testplane will not wait for the element to exist before executing this command.

Usage

await browser.$(selector).waitForClickable({ timeout, reverse, timeoutMsg, interval });

Command Parameters

NameTypeDefaultDescription
timeoutNumber500Timeout in milliseconds.
reverseBooleanfalseIf true, the command will wait for the opposite condition: the element becomes unclickable.
timeoutMsgStringN/AError message to throw when the timeout is reached.
intervalNumberwaitforIntervalInterval in milliseconds between condition checks.

Usage Examples

it("should detect when element is clickable", async ({ browser }) => {
const elem = await browser.$("#elem");
await elem.waitForClickable({ timeout: 3000 });
});

it("should detect when element is no longer clickable", async ({ browser }) => {
const elem = await browser.$("#elem");
await elem.waitForClickable({ reverse: true });
});

References

We'd like to give credit to the original WebdriverIO docs article, from which we drew some information while writing our version.