Appearance
Function: getFrame()
ts
function getFrame(
ctx: Context,
selector: string,
options?: WaitForSelectorOptions): Promise<Context>;Defined in: src/pages/index.ts:32
Select an iframe and return its scoped Context.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | The Context to scope the selection. |
selector | string | An iframe selector or nested iframe selectors joined by >>. |
options? | WaitForSelectorOptions | Optional wait options for the selector lookup. |
Returns
Promise<Context>
A new Context scoped from the selected iframe.
Remarks
The selector supports navigating nested iframes using >>:
iframe#outer >> iframe#innermeans: selectiframe#innerinsideiframe#outer.
Example
ts
const iframeCtx = await getFrame(ctx, 'iframe#some-frame');
await click(iframeCtx, 'button#submit');
const nestedIframeCtx = await getFrame(ctx, 'iframe#outer >> iframe#inner');
await click(nestedIframeCtx, 'button#submit');