Is there any Playwright equivalent for waitForResource in CasperJS? How can I write the below code using Playwright?
casper.waitForResource(function test(resource) {
return resource.url.indexOf("submit") > -1;
}
You can use page.waitForRequest()
:
await page.waitForRequest(request => request.url().indexOf('submit') > -1);
This will pause the execution until a request is made that contains the string "submit" in its URL.