await Promise.all([ page.click(selectors.submit), page.waitForNavigation({ waitUntil: 'networkidle0' }), ]);
This will be the first priority to use, since it expects the completion of the entire network and assumes that this is done when you have no more than 0 network calls in 500 ms.
You can also use
await page.waitForNavigation({ waitUntil: 'Load' }}
or you can use
await page.waitForResponse(response => response.ok())
this function can also be used in different places, since it allows you to continue only if all calls are successful, that is, when all the response statuses are in order, i.e. (200-299)
source share