メインコンテンツにスキップ

waitForClickable(クリック可能かどうかの待機)

指定したミリ秒の間、要素がクリック可能になるか、またはクリック不可能になるのを待ちます。

情報

他の要素コマンドとは異なり、WebdriverIOはこのコマンドを実行するために要素が存在するのを待ちません。

使用方法
$(selector).waitForClickable({ timeout, reverse, timeoutMsg, interval })
パラメータ
NameTypeDetails
options
optional
WaitForOptionswaitForEnabled オプション(オプション)
options.timeout
optional
Numberミリ秒単位の時間(デフォルトは waitforTimeout 設定値に基づく)
options.reverse
optional
Booleantrueの場合、反対の状態を待ちます(デフォルト: false)
options.timeoutMsg
optional
String存在する場合、デフォルトのエラーメッセージを上書きします
options.interval
optional
Numberチェック間の間隔(デフォルト: waitforInterval
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 });
});
戻り値
  • <Boolean> return: 要素がクリック可能な場合は true(またはフラグが設定されている場合はその逆)

Welcome! How can I help?

WebdriverIO AI Copilot