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

285
Views
No se puede ejecutar el paquete npm de captura de pantalla de página completa de titiritero

Estoy usando el paquete de titiriteros que se menciona aquí https://www.npmjs.com/package/puppeteer-full-page-screenshot

Guión de código

 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(); })();

Pero después de ejecutar el script, recibo el siguiente 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 answers
Answer question

0

Debe llamar a la función default() de fullPageScreenshot para que funcione:

 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(); })();

Alternativamente, puede usar require en lugar de import y asignar la función default() a 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 Report

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 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!