Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

133
Vistas
How can I get Puppeteer to take PDF of new page?

I am messing with Puppeteer and I am having trouble getting it to take a PDF of a new page.

I can get a PDF of the initial URL just fine, but if I try to get a PDF of a page I open via clicking on a link, it just takes a PDF of the initial page like always.

This is my code:

const puppeteer = require('puppeteer');

async function takePDF(){
    const browser = await puppeteer.launch({
       slowMo:500, defaultViewport:null
    });
    
    const page = await browser.newPage();

    startUrl = 'https://www.google.com/';

    await page.goto(startUrl);

    await page.mouse.click(1030,468, { button: 'left'});    //click I'm Feeling Lucky

    await page.pdf({path: 'screenshot.pdf'});   //take pdf of I'm Feeling Lucky Results

    browser.close();
}

takePDF();

Do I have to fetch the URL and explicitly tell it it's on a new page now? Thanks.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda