pause
Pauses execution for a specific amount of time. It is recommended to not use this command to wait for an
element to show up. In order to avoid flaky test results it is better to use commands like
waitForExist
or other waitFor* commands.
Usage
browser.pause(milliseconds)
Parameters
Name | Type | Details |
---|---|---|
milliseconds | Number | time in ms |
Example
- Asynchronous Mode
- Synchronous Mode
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
});
pause.js
it('should pause the execution', () => {
const starttime = new Date().getTime()
browser.pause(3000)
const endtime = new Date().getTime()
console.log(endtime - starttime) // outputs: 3000
});
caution
Synchronous Mode will depcrecated with Node.js v16. With an update to the underlying Chromium version it became technically impossible to provide the same synchronous behavior. We recommend to start transition to asynchronous command execution. For more information, see our RFC.