Frames, Shadow DOM & Scoping

Switch To Shadow Root

Sets the element search root to the current element's shadow root.

Sets the element search root to the current element's shadow root.

Sets the element search root to the current element's shadow root.

Examples

GPAL Fluent: High-level fluent C# API

browser.InShadowDom("#shadow-host");

MagicHelper: MagicHelper utility library

GPAL.MagicHelper.SwitchToShadowRoot("#shadow-host");

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.SwitchToShadowRoot("#shadow-host").Execute();

Puppeteer Communicator: Low-level communicator

//Same pattern as in-shadow-dom: resolve the host element to a backend node id, then switch context into its shadow root.

var elem = await browser.PuppeteerCommunicator.QuerySelector("#shadow-host"); await browser.PuppeteerCommunicator.InShadowDom(elem.ElementBackendNodeId, sessionId);

REST Client: Direct REST/HTTP client

GPAL.OttoMagicClient.SwitchToShadowRoot("#shadow-host").Execute();