waitForClickable
Wait for an element for the provided amount of milliseconds to be clickable or not clickable.
information
As opposed to other element commands WebdriverIO will not wait for the element to exist to execute this command.
Usage
$(selector).waitForClickable({ timeout, reverse, timeoutMsg, interval })
Parameters
Name | Type | Details |
---|---|---|
options optional | WaitForOptions | waitForEnabled options (optional) |
options.timeout optional | Number | time in ms (default set based on waitforTimeout config value) |
options.reverse optional | Boolean | if true it waits for the opposite (default: false) |
options.timeoutMsg optional | String | if exists it overrides the default error message |
options.interval optional | Number | interval between checks (default: waitforInterval ) |
Example
waitForClickable.js
it('should detect when element is clickable', async () => {
const elem = await $('#elem')
await elem.waitForClickable({ timeout: 3000 });
});
it('should detect when element is no longer clickable', async () => {
const elem = await $('#elem')
await elem.waitForClickable({ reverse: true });
});