Cypress · Middle · Question 18 of 77
How do you query elements inside shadow DOM?
- 1Shadow DOM can't be reached by Cypress at all
- 2Use XPath, the only selector that works there
- 3
includeShadowDom: truein config or.shadow()
Show the answer
Correct answer: includeShadowDom: true in config or .shadow()
Explanation
With the config option, cy.get searches shadow roots. .shadow() steps into a specific host's shadow root.