Skip to main content

sdk.automation.createbackgroundpage

Home > @matterway/sdk > Automation > createBackgroundPage

Automation.createBackgroundPage() function

Creates a new background browser tab, and returns its scoped Context.

Signature:

export declare function createBackgroundPage(ctx: Context, url?: string): Promise<Context>;

Parameters

ParameterTypeDescription
ctxContextContext object.
urlstring(Optional) URL to navigate to.

Returns:

Promise<Context>

Context object where page is the newly created background tab.

Remarks

The tab will be created in a minimized window of the same browser of the given ctx.

Example

const backgroundPageCtx = await createBackgroundPage(ctx, 'https://example.com');
await click(backgroundPageCtx, 'button#submit');