Is there any possible way to access elements inside closed shadow DOM using Puppeteer?
I understand that the point of closed shadow DOM is for the items not to be accessible, but since Puppeteer is used to scrape webpages, I think it would be reasonable that we can access it using Puppeteer.
Thanks in advance.
I tried accessing elements inside a closed shadow DOM using Puppeteer but I couldn’t do it.
Example:
const browser = await puppeteer.launch({
headless: true,
});
const page = await browser.newPage();
await page.goto("http://localhost:8080/iframe-test-nested.html");
const result = await page.$("body layout-container");
if (!result) {
console.log("Element not found");
} else {
const innerHTML = await page.evaluate((el) => el.innerHTML, result);
console.log(innerHTML);
}
await browser.close();