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

119
Vistas
Get popup URL after a new request from javascript on playwright

I have a button on a page that opens a popup (new tab). I can get this popup with a listener:

page.on('popup', async popup => {
       console.log('popup => ' + await popup.url());
    })

The problem is that the website opens it with an "about:blank" link, and later loads an URL.

I tried to wait a few seconds before get the url but it keeps showing a blank string.

page.on('popup', async popup => {
       await page.waitForTimeout(10000);
       console.log('popup => ' + await popup.url());
    })

The main page after opens the popup, changes it URL. So im not able, yet, to get this URL sent to the popup.

Any idea? Thanks!

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

try to set the url on a const before console.logging

page.on('popup', async popup => {
     await page.waitForTimeout(10000);
     const url = await popup.url()
     console.log('popup => ' + url);
})
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can wait for navigation of the popup before printing out its url:

page.on('popup', async popup => {
  await popup.waitForNavigation();
  console.log('popup => ' + await popup.url());
})
about 4 years ago · Juan Pablo Isaza Denunciar
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