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

135
Views
how can I get the url of a page that opened in a different tab with puppeteer, or extract the URL from the " click here " link?
// this clicks on the link after page is loaded,
// there is whole process going before coming to this point.
await page.click('#ctl00_chpMain_ucContractDetails');

const url = await newPage.evaluate(() => document.location.href);
console.log(url); // this code didnt work for me.
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to catch the tab creation event:

const [url] = await Promise.all([
  new Promise((resolve, reject) => {
    browser.once('targetcreated', (target) => { resolve(target.url()); });
  }),
  page.click('#ctl00_chpMain_ucContractDetails'),
]);

console.log(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!