waitForDisplayed
等待元素在指定的毫秒數內顯示或不顯示。
資訊
與其他元素指令相反,WebdriverIO 不會等待元素存在才執行此指令。
用法
$(selector).waitForDisplayed({ timeout, reverse, timeoutMsg, interval, withinViewport })
參數
名稱 | 類型 | 詳細資訊 |
---|---|---|
options 選填 | WaitForOptions | waitForDisplayed 選項 (選填) |
options.timeout 選填 | 數字 | 毫秒為單位 (預設值根據waitforTimeout 設定值) |
options.reverse 選填 | 布林值 | 如果為 true,則等待相反的結果 (預設值:false) |
options.timeoutMsg 選填 | 字串 | 如果存在,則覆寫預設錯誤訊息 |
options.interval 選填 | 數字 | 檢查之間的間隔 (預設值:waitforInterval ) |
options.withinViewport 選填 | 布林值 | 設定為 true 以等待元素在可視區域內顯示 (預設值:false ) |
範例
index.html
loading...
waitForDisplayedExample.js
loading...