map , forEach , reduce , etc. Do not wait for an asynchronous operation inside them before moving on to the next element of the iterator that they iterate over.
There are several ways to simultaneously traverse each element of the iterator during an asynchronous operation, but the simplest in this case, I think, would be to simply use the usual for statement, which waits for the operation to complete.
const urls = [...] for (let i = 0; i < urls.length; i++) { const url = urls[i]; await page.goto(`${url}`); await page.waitForNavigation({ waitUntil: 'networkidle' }); }
This will visit one URL after another as you expect. If you are curious to repeat the iteration using await / async, you can take a look at this answer: fooobar.com/questions/44161 / ...
source share