跳到主要內容

pause

暫停執行一段特定的時間。建議不要使用此命令來等待元素顯示。為了避免不穩定的測試結果,最好使用像waitForExist或其他 waitFor* 命令。

用法
browser.pause(milliseconds)
參數
名稱類型詳細資訊
毫秒數字時間,單位為毫秒
範例
pause.js
it('should pause the execution', async () => {
const starttime = new Date().getTime()
await browser.pause(3000)
const endtime = new Date().getTime()
console.log(endtime - starttime) // outputs: 3000
});

歡迎!我能如何幫您?

WebdriverIO AI Copilot