t.setPageLoadTimeout Method

Important

This method is deprecated. Use the test.timeouts Method to set the pageLoadTimeout.

Sets the maximum acceptable time between the DOMContentLoaded event and the window.load event. Chainable.

t.setPageLoadTimeout(duration) → this | Promise<any>
Parameter Type Description
duration Number Page load timeout (in milliseconds). 0 to skip waiting for the window.load event.

After the timeout passes or the window.load event is raised (whichever happens first), TestCafe starts the test.

You can also set the page load timeout when you launch tests from the command line or the API.

Example

fixture`TestController.setPageLoadTimeout`
    .page`https://devexpress.github.io/testcafe/example/`;

test('Page load timeout', async t => {
    await t
        .setPageLoadTimeout(0)
        .navigateTo('https://devexpress.github.io/testcafe/');
});

Note

The DOMContentLoaded event always precedes the window.load event. It fires when the browser has loaded and parsed the HTML content of the page. The window.load event, on the other hand, fires when the browser has loaded all the style sheets, images, and sub-frames.