I'm using puppeteer to click on a link that opens a new tab, and take a screenshot of this tab using :
const pages = await browser.pages()
const new_page = pages[pages.length-1]
await new_page.screenshot()
but I made some research and I found that browser.pages() contains only the default blank pages and my current tab but not the new one.
Hence, when I take a screenshot, it takes a screenshot of the current tab.
To give you some context, the new tab is a PHP URL and it displays a pdf file. I tried waitForNavigation, bringToFront and nearly every possible console.log().
Does anyone know how to help me?
consider using targets:
const page = await target.page()
await page.bringToFront()
await page.screenshot(...)