ripe-grayR
Apify & Crawlee2y ago
1 reply
ripe-gray

Puppeteer waitForResponse in a loop. Is it possible?

        for (let i = 1; i <= 5; i++) {
            const [response] = await Promise.all([
                page.waitForResponse((res) => res.url() !== locationURL  && res.url().includes('/approved-used?')),
                page.click('.load-more button')
            ]);


            const d = await response.json();


Basically my code looks something like this. I click the load more button and want to grab ajax api call response data. It works only on the first try, then it just fails, due to waitForResponse never getting the response

Am I missing something?
Was this page helpful?