Capture url of web page when the site is broken

We are trying to capture the actual url when it navigates to another page. const currentURL: string = await this.page.url(); It works fine and capture the url when the targetted link opens without any error page. But if the targetted links are broken, it captures "chrome-error://chromewebdata/" instead of actual url in address bar. Any solution to capture the actual url ?

May 12, 2025 - 19:17
 0
Capture url of web page when the site is broken

We are trying to capture the actual url when it navigates to another page.
const currentURL: string = await this.page.url();
It works fine and capture the url when the targetted link opens without any error page. But if the targetted links are broken, it captures "chrome-error://chromewebdata/" instead of actual url in address bar.

Any solution to capture the actual url ?