Page
Page.locator(selector) returns a Locator scoped to a selector; every getByRole/getByText/etc. builder documented under Locator is also callable straight on page.
goto
Navigates the page to a URL. navigate() is an alias.
goto(url: string, options?: CommandOptions): Promise<NavigateResult>Example
await page.goto("https://themoderninternet.vercel.app");click
Clicks the first element matching selector.
click(selector: string, options?: CommandOptions): Promise<ClickResult>fill
Sets an input's value.
fill(selector: string, value: string, options?: CommandOptions): Promise<FillResult>Example
await page.fill('input[name=email]', 'you@example.com');hover
Hovers the pointer over the matching element.
hover(selector: string, options?: CommandOptions): Promise<ElementResult>press
Sends a key press to the matching element, optionally typing PressOptions.text in the same call.
press(selector: string, key: string, options?: PressOptions): Promise<PressResult>focus
Focuses the matching element.
focus(selector: string, options?: CommandOptions): Promise<ElementResult>highlight
Visually highlights matching elements for a duration — a debugging aid, not an assertion.
highlight(selector: string, options?: HighlightOptions): Promise<HighlightResult>count
Returns how many elements match selector.
count(selector: string, options?: CommandOptions): Promise<CountResult>textContent / innerText
Reads the element's raw textContent, or its rendered innerText.
textContent(selector: string, options?: CommandOptions): Promise<TextResult>
innerText(selector: string, options?: CommandOptions): Promise<TextResult>waitForSelector
Waits, retrying, until selector matches — optionally requiring visible: true.
waitForSelector(selector: string, options?: WaitForSelectorOptions): Promise<WaitForSelectorResult>screenshot
Captures a PNG screenshot; options.fullPage captures the whole scrollable page, and options.path writes the PNG to disk.
screenshot(options?: ScreenshotOptions): Promise<ScreenshotResult>accessibilitySnapshot
Captures the accessibility tree as JSON or YAML text; options.mode selects "default", "ai" (stable per-node reference), "autoexpect", or "codegen".
accessibilitySnapshot(options?: AccessibilitySnapshotOptions): Promise<string>Example
const tree = JSON.parse(await page.accessibilitySnapshot({ mode: "ai" }));locator
Builds a Locator scoped to this page for a CSS/XPath/aw= selector, or use the getBy* semantic builders documented under Locator.
locator(selector: string, options?: LocatorFilterOptions): LocatorregisterHook
Registers a lifecycle hook before the action that triggers it.
registerHook<T>(type: HookType<T>): Promise<Hook<T>>