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

118
Views
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 answers
Answer question

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 Report

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