Frames, Shadow DOM & Scoping

In Iframe

Scope subsequent selectors to inside an iframe.

Scope subsequent selectors to inside an iframe.

Switches the document content context into the matched iframe, so that following selectors are evaluated within that iframe. Call InIframe with the iframe's own selector first, then WithSelector for elements inside it. Use InMainDom() to return to the top-level document.

TIP

ApiEndpoint.InIframe exists in the enum for validation/cataloging purposes, but OttoMagic (and RESTClient) never dispatch it as a REST call - OttoMagic already runs in every frame, so no frame switch is needed there.

Examples

GPAL Fluent: High-level fluent C# API

browser .InIframe(iframeSelector) .WithSelector(childSelector) .LeftClick();

Puppeteer Client: Puppeteer-style C# client

//At the Puppeteer layer, entering an iframe is handled via switch-to-frame (PuppeteerClient.SwitchToFrame), which Browser.InIframe calls internally.

browser.PuppeteerClient.SwitchToFrame("#iframe-selector").Execute();

Puppeteer Communicator: Low-level communicator

await browser.PuppeteerCommunicator.InIframe("frame123", sessionId);