Re: [puppeteer/puppeteer] Query nodes within shadow roots (#858)

Did anybody find a working solution on how to interact with shadow-root elements?

I am able to 'click' on the element using the following code

```
async function selectShadowElement(elementSelector) {
    try {
        const container = document.querySelector('parentSelector')
        return container.shadowRoot.querySelector(elementSelector)
    } catch (err) {
        return null
    }
}

const element = 'elementSelector'
const result = await page.waitForFunction(selectShadowElement, {timeout: 15 * 1000}, element)

if (!result) {
  console.error('Shadow element was not found!')
  return
}

await(await page.evaluateHandle(selectShadowElement, element)).click()
```
but did not able to get the value from an attribute

-- 
Reply to this email directly or view it on GitHub:
https://github.com/puppeteer/puppeteer/issues/858#issuecomment-1118951060
You are receiving this because you were mentioned.

Message ID: <puppeteer/puppeteer/issues/858/1118951060@github.com>

Received on Thursday, 5 May 2022 19:05:46 UTC