Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

284
Visualizações
Not able to run puppeteer-full page screenshot npm package

I am using pupeeter package which is mentioned here https://www.npmjs.com/package/puppeteer-full-page-screenshot

Code Script

import puppeteer from 'puppeteer';
import fullPageScreenshot from 'puppeteer-full-page-screenshot';

(async () => {
   const browser = await puppeteer.launch();
   const page = await browser.newPage();
   await page.setViewport({ width: 1920, height: 1080 });
   await page.goto('http://lambdatest.com/');

   await fullPageScreenshot(page, { path: './page.png' });

   await browser.close();
})();

But after running the script, I am getting following error

(node:39184) UnhandledPromiseRejectionWarning: TypeError: fullPageScreenshot is not a function
    at file:///Users/arushsaxena/Desktop/DotlapseDemo/smartui-node-sample/puppeteer-lib.js:10:10
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:39184) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:39184) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You need to call the default() function of fullPageScreenshot to make it work:

import puppeteer from 'puppeteer';
import fullPageScreenshot from 'puppeteer-full-page-screenshot';

(async () => {
   const browser = await puppeteer.launch();
   const page = await browser.newPage();
   await page.setViewport({ width: 1920, height: 1080 });
   await page.goto('http://lambdatest.com/');

   await fullPageScreenshot.default(page, { path: './page.png' });

   await browser.close();
})();

Alternatively, you can use require instead of import and assign the default() function to fullPageScreenshot:

const puppeteer = require('puppeteer');
const fullPageScreenshot = require('puppeteer-full-page-screenshot').default;

(async () => {
   const browser = await puppeteer.launch();
   const page = await browser.newPage();
   await page.setViewport({ width: 1920, height: 1080 });
   await page.goto('http://lambdatest.com/');

   await fullPageScreenshot(page, { path: './page.png' });

   await browser.close();
})();
about 4 years ago · Juan Pablo Isaza Relatório

0

import puppeteer from 'puppeteer';

import fullPageScreenshot from 'puppeteer-full-page-screenshot';

(async () => {
   const browser = await puppeteer.launch();

   const page = await browser.newPage();

   await page.setViewport({ width: 1920, height: 1080 });

   await page.goto('http://lambdatest.com/');


   await page.screenshot({ path: 'fullpage.png', fullPage: true });

   await browser.close();
})();
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda