Talk: Automating Shadow DOM Web Components with WebDriver
summary
Shows how a reusable custom element <unique-signup-form> is built (attributes, HTML templates and slots), and how tests automate it with Java + Selenium 4, WebDriverManager and JUnit using a GitHub demo repo. Uses open Shadow DOM so WebDriver’s getShadowRoot can return a root; closed shadow throws an exception. Demonstrates nested Shadow DOMs (up to seven levels encountered), asserts styles via getCssValue, and controls closed components (video, date picker, CKEditor) by calling their JS API with executeScript, which reliably works when Shadow access is blocked.
AI-written summary · about
chapters (9)
- 0:00Introduction and speaker intro
- 1:33What are Shadow DOM and Web Components
- 15:21Building custom web components
- 28:42Automating regular forms
- 34:26Automating Shadow DOM components
- 38:46Nested Shadow DOM automation
- 40:51Automating standard HTML5 controls
- 43:23JavaScript API for complex controls
- 44:34Summary and Q&A
