I notice that when clicking on a link, a new tab is opened with the new page. However, the elements of that page are not visible, and even trying to print the URL of the page to see if it works as expected does not give me the expected result. It's as if the new tab opened correctly, but it is not interacting with it, behaving as if on a blank page.
I'am using Playwright and Typescript for produce this web-scraping.
You need to handle the page. In playwright we need to initialize the listner before opening new tab. So when you are going to click on link and new tab is going to open you first need write listner as waitForEvent('page'). Then click on link and then navigate to the new page. In below code we have saved the new page instance in newPage variable and using the same for all next operation.
const pagePromise = context.waitForEvent('page');
await runLink.click();
const newPage = await pagePromise;
await newPage.waitForLoadState();
console.log(await newPage.title());