setTimeout
Overview
Use the setTimeout
command to set timeouts for element searches on the page, document load waits, and script executions through the execute or executeAsync commands.
Usage
await browser.setTimeout({ implicit, pageLoad, script });
Command Parameters
Name | Type | Description |
implicit | Number | Time in milliseconds for retrying element location when searching for an element. |
pageLoad | Number | Time to wait for the document to load, in milliseconds. |
script | Number | Timeout for scripts run using execute or executeAsync, in milliseconds. |
Usage Examples
it("should change timeout duration for session with long code duration", async ({ browser }) => {
await browser.setTimeout({
pageLoad: 10000,
script: 60000,
});
// execute code that takes a long time
await browser.executeAsync(done => {
console.log("Wake me up before you go!");
setTimeout(done, 59000);
});
});
References
We'd like to give credit to the original WebdriverIO docs article, from which we drew some information while writing our version.