Перейти до основного вмісту

waitForClickable

Очікувати поки елемент стане клікабельним або не клікабельним протягом заданої кількості мілісекунд.

інфо

На відміну від інших команд елементів, WebdriverIO не чекатиме існування елемента для виконання цієї команди.

Usage
$(selector).waitForClickable({ timeout, reverse, timeoutMsg, interval })
Parameters
NameTypeDetails
options
optional
WaitForOptionswaitForEnabled options (optional)
options.timeout
optional
Numbertime in ms (default set based on waitforTimeout config value)
options.reverse
optional
Booleanif true it waits for the opposite (default: false)
options.timeoutMsg
optional
Stringif exists it overrides the default error message
options.interval
optional
Numberinterval 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 });
});
Returns
  • <Boolean> return: true if element is clickable (or doesn't if flag is set)

Welcome! How can I help?

WebdriverIO AI Copilot