Is there a way to force the page to stop loading any further when one of the required DOM elements has been loaded?
Similar to pressing the escape button on the browser to stop the page loading any further, is there a way to do this in Testcafe please?
CodePudding user response:
I think the following should work:
const cancelLoading = ClientFunction(() => window.stop());
then whenever you call await cancelLoading()
, the page should stop loading further. For example after you find an element:
const inputField = Selector('#just-an-example');
await t
.expect(inputField.visible).ok()
await cancelLoading();