How to get body / json response from XHR request with Puppeteer How to get body / json response from XHR request with Puppeteer node.js node.js

How to get body / json response from XHR request with Puppeteer


As response.json returns a promise we need to await it.

page.on('response', async (response) => {        if (response.url() == "https://capuk.org/ajax_search/capmoneycourses"){        console.log('XHR response received');         console.log(await response.json());     } });