Appearance
Function: createBackgroundPage()
ts
function createBackgroundPage(
ctx: Context,
url?: string,
options?: GoToOptions): Promise<Context>;Defined in: src/pages/index.ts:168
Create a background browser tab that opens minimized.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | The current Context. |
url? | string | URL to open. Defaults to https://www.google.com/ for extension pages. |
options? | GoToOptions | Optional Puppeteer GoToOptions. |
Returns
Promise<Context>
A new Context scoped to the background tab.
Remarks
The tab opens in a minimized window of the same browser as ctx. For extension pages the default URL is https://www.google.com/.
Example
ts
const reportCtx = await createBackgroundPage(ctx, 'https://reports.megacorp.com/quarterly');
await waitForSelector(reportCtx, 'table#revenue-summary');