Module · DOM & Web Components

Shadow DOM Lab

Locate the Host → Traverse the Shadow Root → Interact → Validate.

Practice automating modern Web Components and Shadow DOM boundaries. Work with open Shadow Roots, nested components, closed Shadow DOM, controls hidden inside components, and external navigation triggered from Shadow DOM.

Open Shadow Root Login Form

Locate the Shadow Host, access the controls inside the open Shadow Root, complete the login workflow, and validate the result.

Light DOM
Shadow Host
Open Shadow Root
Form Controls

Nested Shadow DOM

Shadow DOM can nest: a component inside a component inside a component, each with its own Shadow Root. Automation has to traverse every boundary, not just the outermost one.

📦 Host 1
📦 Host 2
📦 Host 3
🟢 Submit Button

Closed Shadow Root

This component uses a closed Shadow Root. The internal DOM is intentionally not exposed through the public Shadow DOM API. Can you automate this?

🔒 Closed Shadow Root

element.shadowRoot === null

No public traversal API available.

Requires application changes. Closed mode has no public traversal API. This demonstrates a real interview limitation.

Product Search (all controls inside shadow roots)

These controls live inside a Shadow Root. Your automation must locate and interact with them correctly — search, filter by category, filter by price, then read the results.

Shadow Settings Panel

Select a theme, toggle Email Alerts, click Apply Settings, and validate the resulting state — every control lives inside an open Shadow Root.

External Navigation Challenge

Locate an external link inside a Shadow Root and handle the newly opened page — Shadow DOM and popup/new-page handling often show up together in real applications.

↑ Back to top