How to expose the url property for links in Puppeteer

Puppeteer

If you need the full URL of a link in Puppeteer, use the url property that was added in the related change. You can read it from a link element like this:

// using a link element handle
const href = await linkHandle.getProperty('href');
const url = await href.jsonValue();
console.log(url); // full absolute URL

Or via evaluate:

const url = await linkHandle.evaluate(el => el.href);

This exposes the link url for use in tests and automation.