Appearance
Function: createPage()
ts
function createPage(
ctx: Context,
url?: string,
options?: GoToOptions): Promise<Context>;Defined in: src/pages/index.ts:128
Create a new browser tab and return its scoped Context.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | The current Context. |
url? | string | URL to open in the new tab. |
options? | GoToOptions | Optional Puppeteer GoToOptions. |
Returns
Promise<Context>
A new Context scoped to the created tab.
Remarks
The tab opens in the same browser as the given ctx.
Example
ts
const supplierCtx = await createPage(ctx, 'https://suppliers.megacorp.com/portal');
await click(supplierCtx, 'button#view-orders');