跳到主要内容

暂停

暂停执行特定的时间。不建议使用此命令来等待元素显示。为了避免测试结果不稳定,最好使用waitForExist或其他waitFor*命令。

用法
browser.pause(milliseconds)
参数
名称类型详情
millisecondsnumber时间(毫秒)
示例
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
});

Welcome! How can I help?

WebdriverIO AI Copilot