Skip to main content

Pages

A Page (client/page.ts:80) represents a single tab or popup window within a browser context.

Creating Pages

From Context

Shortcut (Creates Context + Page)

From client/browser.ts:137:

Page Lifecycle

1

Page Creation

2

Navigation

3

Interaction

4

Cleanup

Basic Navigation

From client/frame.ts:111-115:
Wait states:
  • load - Page load event fired (default)
  • domcontentloaded - DOM is ready
  • networkidle - No network connections for 500ms
  • commit - Navigation committed

History Navigation

Wait for Navigation

Frames

Frames represent the main document or iframes within a page.

Accessing Frames

Frame Hierarchy

From client/page.ts:174-188:

Working with Frames

FrameLocator

A modern way to work with iframes:
From client/locator.ts:405:
FrameLocator is recommended over page.frame() as it automatically waits and handles frame lifecycle.

Page Properties

URL

Title

Content

Viewport

Page Events

Dialog Handling

Workers

Access Web Workers and Service Workers:

Multiple Pages

Page Isolation

Pages within the same context share state:

Viewport and Emulation

Screenshots

PDF Generation

Accessibility

Performance

Best Practices

Always wait for appropriate load state after navigation.
Use FrameLocator for iframe interactions.
Set up event listeners before triggering actions.

Frame vs FrameLocator

Next Steps

Selectors

Learn how to find elements

Auto-waiting

Understanding automatic waiting

Locators

Working with locators