0

I try to get some data from the page.on(‘response’) event. This data should be pushed into the dataset with pushData.

It seems that this events:

await page
    .on('response', response => {
        if (response.status() === 404) {
            responseErrors.push(new Object({
                status: response.status(),
                url: response.url()
            }))
        }
    })
    .on('pageerror', err => {
        if (err.message) {
            pageErrors.push(JSON.stringify(err.message))
        }
    })
    .on('console', message => {
        consoleErrors.push(new Object({
            type: message.type(),
            url: message.text()
        }))
    });

Have no response if they are used in handlePageFunction.

If i add them to the gotoFunction of PuppeteerCrawler i get results. The problem is that i cant push into the same dataset.

So what would be the right way to access this data?