I’m currently utilizing Puppeteer for evaluating the performance of web pages and features as I’m in the early stages of this project. Below is a sample code I’m working with:
const puppeteer = require('puppeteer');
(async () => {
const browserInstance = await puppeteer.launch({headless: false});
const webPage = await browserInstance.newPage();
await webPage._client.send('Performance.enable');
await webPage.goto('https://xxxx.com');
await webPage.focus('#formulario input#email');
await webPage.type('[email protected]', {delay: 200});
await webPage.focus('#formulario input#password');
await webPage.type('pass', {delay: 200});
const formElement = await webPage.$('#formulario');
await formElement.evaluate(form => form.submit());
formElement._client.send('Performance.getMetrics');
// THIS DOES NOT WORK AS EXPECTED AFTER THE PAGE TRANSITION
await webPage.click('span.filter-options');
await browserInstance.close();
})();
How can I interact with the new page that appears after logging in through the form? I need to grab the reference to this newly loaded page.