有効になるまで待機
(CSSセレクターで選択された)要素が、指定されたミリ秒数だけ(無効/有効)になるまで待機します。指定されたセレクターで複数の要素が照会された場合、少なくとも1つの要素が(無効/有効)であればtrueを返します。
情報
他の要素コマンドとは異なり、WebdriverIOはこのコマンドを実行するために要素が存在するまで待機しません。
使用方法
$(selector).waitForEnabled({ timeout, reverse, timeoutMsg, interval })
パラメータ
| 名前 | タイプ | 詳細 | 
|---|---|---|
| オプション任意 | WaitForOptions | waitForEnabled オプション (任意) | 
| options.timeout任意 | 数値 | ミリ秒単位の時間 (デフォルトは waitforTimeout設定値に基づいて設定されます) | 
| options.reverse任意 | 真偽値 | trueの場合、反対の状態を待機します (デフォルト: false) | 
| options.timeoutMsg任意 | 文字列 | 存在する場合、デフォルトのエラーメッセージをオーバーライドします | 
| options.interval任意 | 数値 | チェック間のインターバル (デフォルト: waitforInterval) | 
例
index.html
<input type="text" id="username" value="foobar" disabled="disabled"></input>
<script type="text/javascript">
    setTimeout(() => {
        document.getElementById('username').disabled = false
    }, 2000);
</script>
waitForEnabledExample.js
it('should detect when element is enabled', async () => {
    await $('#username').waitForEnabled({ timeout: 3000 });
});
it('should detect when element is disabled', async () => {
    elem = await $('#username');
    await elem.waitForEnabled({ reverse: true })
});