Код: Выделить всё
const grab = async(url) => {
const browser = await puppeteer.launch({ headless: false});
const page = await browser.newPage();
await page.setRequestInterception(true);
page.on("request", async (request) => {
const current = await request.url();
if (current.includes('betty-variants')) {
console.log(request.url())
}
//This clicking not working here, the page does not see this selector
// await page.waitForSelector('.well-sm.well p.text-primary.pull-left span', { timeout: 5000})
// await page.click('.well-sm.well p.text-primary.pull-left span')
// Allow the request to be sent
await request.continue();
});
await page.goto(url, { waitUntil: 'networkidle2' });
await page.waitForSelector('.well-sm.well p.text-primary.pull-left span');
await page.click('.well-sm.well p.text-primary.pull-left span')
await browser.close();
};
Подробнее здесь: https://stackoverflow.com/questions/795 ... -puppeteer