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
});