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

124
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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