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
Name | Type | Default | Description |
timeout | Number | 500 | Timeout in milliseconds. |
reverse | Boolean | false | If true, the command will wait for the opposite condition: the element becomes unclickable. |
timeoutMsg | String | N/A | Error message to throw when the timeout is reached. |
interval | Number | waitforInterval | Interval 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.