Playwright CDP icon

Playwright CDP

Automate browser interactions using Playwright with remote browser via CDP

Get Page Content

AI-generated

Summary

Navigate to a URL via Chrome DevTools Protocol and return the page's HTML body, headers, and status code.

Inputs

  • cdpEndpoint (required) — The CDP endpoint URL to connect to the remote browser. Can be HTTP or WebSocket URL (e.g., http://localhost:9222 or ws://localhost:9222/devtools/browser/xxx)
  • url (required) — The URL to navigate to. Required for getPageContent, getScreenshot, and getPDF operations.
  • authentication — Authentication method for the CDP connection. Defaults to 'none'. Options: 'none', 'httpBasicAuth'.
  • queryParameters — Query parameters to append to the URL. Multiple parameters can be added.
  • options — Execution options affecting navigation and page context.

Output shape

array of objects, each containing { body: string, headers: object, statusCode: number, url: string }

Returned when operation is 'Get Page Content'. Each item corresponds to one processed page. Returns an error if navigation fails or the operation is unsupported.

Examples

Example 1: Fetch raw HTML from a local development server running under CDP.

cdpEndpoint: http://localhost:9222; url: https://example.com; authentication: none; options: { waitUntil: 'domcontentloaded', timeout: 15000 }

Discussion