Function getFrame

  • Selects an iframe, and returns its scoped Context.

    Parameters

    • ctx: Context

      The Context to scope the selection.

    • selector: string

      An iframe selector or nested iframe selectors joined by >>.

    • Optionaloptions: WaitForSelectorOptions

    Returns Promise<Context>

    A new Context scoped from the selected iframe.

    The selector supports navigating nested iframes using >>:

    • iframe#outer >> iframe#inner means: select iframe#inner inside iframe#outer.
    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');