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

278
Views
Titiritero - Manejo de múltiples ventanas (mismo contexto)

Hay muy poca información disponible y he intentado varias cosas, pero aparentemente no hay forma de saber de Puppeteer si la ventana es diferente, por ejemplo, si muevo manualmente una "pestaña" (no en headless) afuera, esto crea una nueva ventana, aparentemente no hay forma de saberlo o tener un concepto de Windows en Puppeteer, ¿alguien puede arrojar luz sobre esto?

No deseo abrir más instancias de Chromium, ya que quiero seguir con el mismo perfil (sin copia), quiero tratar con varias ventanas (no con pestañas).

Selenium tiene una forma clara de manejar eso usando getWindowHandle

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

0

Actualmente, Puppeteer no ofrece una API para hacer eso. El Protocolo Chrome DevTools (CDP) subyacente podría ofrecer lo que necesita. Consulte el parámetro newWindow de Target.createTarget https://chromedevtools.github.io/devtools-protocol/tot/Target/#method-createTarget . Debería ser posible obtener acceso a CDP y crear una nueva ventana de la siguiente manera:

 // pseudo-code, not tested if it works. const client = await browser.target().createCDPSession(); const {targetId} = await client.send('Target.createTarget', { url: ..., newWindow: true }); const newTarget = await browser.waitForTarget(target => target.id === targetId);

Parece newWindow solo tiene efecto en modo headful.

about 4 years ago · Juan Pablo Isaza Report

0

Puedes probar titiritero-cluster .

Así es como se ve el ejemplo:

 const { Cluster } = require('puppeteer-cluster'); (async () => { const cluster = await Cluster.launch({ concurrency: Cluster.CONCURRENCY_CONTEXT, maxConcurrency: 2, }); await cluster.task(async ({ page, data: url }) => { await page.goto(url); const screen = await page.screenshot(); // Store screenshot, do something else }); cluster.queue('http://www.google.com/'); cluster.queue('http://www.wikipedia.org/'); // many more pages await cluster.idle(); await cluster.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!