Skip to content

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

ParameterTypeDescription
ctxContextThe Context to scope the selection.
selectorstringAn iframe selector or nested iframe selectors joined by >>.
options?WaitForSelectorOptionsOptional 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#inner means: select iframe#inner inside iframe#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');

Matterway Assistant SDK Documentation