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

166
Vistas
¿Esperar a que se completen todas las descargas con Puppeteer?

Intento usar el código de esta pregunta , pero no funciona.

El waitForFunction parece omitirse y no se evalúa.

Se muestra chrome://downloads/, el archivo aún se descarga y el script finaliza.

 const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch({ headless: false, slowMo: 100, // Uncomment to visualize test }); const page = await browser.newPage(); await page.goto('https://speed.hetzner.de/'); // Resize window to 1588 x 901 and await navigation await page.setViewport({ width: 1588, height: 901 }); // Click on <a> "10MB.bin" await page.waitForSelector('[href="10GB.bin"]'); await page.click('[href="10GB.bin"]'); dmPage = await browser.newPage() await dmPage.goto('chrome://downloads/') await dmPage.bringToFront() await dmPage.waitForFunction(() => { // monitoring the state of the first download item // if finish than return true; if fail click const dm = document.querySelector('downloads-manager').shadowRoot const firstItem = dm.querySelector('#frb0') if (firstItem) { const thatArea = firstItem.shadowRoot.querySelector('.controls') const atag = thatArea.querySelector('a') if (atag && atag.textContent === 'Show in folder') { return true } const btn = thatArea.querySelector('cr-button') if (btn && btn.textContent === 'Retry') { btn.click() } } }, { polling: 'raf', timeout: 0 }, // polling? yes. there is a 'polling: "mutation"' which kind of async ) console.log('finish') // await browser.close(); })();

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