Better Support for Shadow DOM
See original GitHub issueSince Copy JS Path
has landed in Chrome DevTools, we now have a way to address nodes inside shadow DOM.
Details: https://github.com/GoogleChrome/puppeteer/issues/858#issuecomment-438540596
This, however, doesn’t simplify life much when it comes to sugar methods, such as page.click
, page.select
and others.
It’d be nice to have a way to address nodes in shadow DOM in these methods.
Suggestions:
- Teach
page.click
and others to accept an array of selectors. (source).
await page.select(['#container', 'select#foo'], 'value');
- Teach
page.click
and others to treat jsPaths as selectors.
await page.select("document.querySelector('body > toolbar-component > toolbar-section.left')", 'value');
Issue Analytics
- State:
- Created 5 years ago
- Reactions:20
- Comments:11
Top Results From Across the Web
Shadow DOM (V1) | Can I use... Support tables for ... - CanIUse
Method of establishing and maintaining functional boundaries between DOM trees and how these trees interact with each other within a document, thus enabling ......
Read more >Using shadow DOM - Web Components | MDN
Shadow DOM allows hidden DOM trees to be attached to elements in the regular DOM tree — this shadow DOM tree starts with...
Read more >Cross Browser Compatibility Score of Shadow DOM (V1)
Shadow DOM (V1) shows a browser compatibility score of 88. This is a collective score out of 100 to represent browser support of...
Read more >Declarative Shadow DOM - web.dev
It's best to check this.shadowRoot for any existing shadow root in your element's constructor. If there is already a value, the HTML for...
Read more >Shadow DOM Support - Pendo Help Center
Pendo supports Shadow DOM elements for feature tagging and page element positioning for Guides. What is a Shadow DOM? ... Read more about...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@aslushnikov Is there any planned worked for this from the Puppeteer team? Considering about %8 of page loads use custom elements (and most likely shadow dom) it feels like a prominent framework such as Puppeteer could use a more native approach 😃
Another thing to consider that in an application where every (web)component is a shadow root, this would basically be equivalent to an exact step by step DOM path instead of a “selector”. This means you would have to update all your e2e tests every time you change anything about the DOM structure, which would be extremely annoying (no matter if it supports JS path or arrays).
Maybe another better option would be to have an option
{ penetrateShadowRoot: true }
to the functions that would recursively dig into shadow roots.