Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

88
Views
Take screenshot with of PDF opened in a new tab

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

consider using targets:

  1. browser.waitForTarget()
  2. browser.on('targetcreated'))
  3. browser.targets()
const page = await target.page()
await page.bringToFront()
await page.screenshot(...)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!