Playwright icon

Playwright

Automate browser tasks with Playwright and optional CDP connection

Browser → Get HTML

AI-generated

Summary

Retrieve the full HTML content of the current page loaded in a Playwright browser session.

Inputs

  • Connection Mode (required) — Choose to either launch a new browser instance or connect to an existing one via Chrome DevTools Protocol (CDP).
  • Browser Type (required) — Select Chromium, Firefox, or WebKit browser to launch (shown only when launching a new browser).
  • Headless — Run the browser without a visible UI window (applicable only when launching).
  • CDP Endpoint (required) — URL endpoint for connecting to an existing browser instance via CDP (required if connecting).
  • Timeout (MS) — Maximum wait time for any browser action before timing out.
  • Session ID — Identifier to reuse the same browser/page session across nodes.
  • Use Existing Tab — Reuse an already-open tab in the connected browser (only for CDP mode).
  • Tab Index — Zero-based index specifying which tab to reuse if Use Existing Tab is enabled.
  • Block Resource Types — List of resource types to block/abort loading, reducing bandwidth for new pages.
  • Block URL Patterns — Comma-separated URL glob patterns to block requests for matching URLs on new pages.
  • Additional Data — Any JSON data to include in the output for contextual use.
  • Target URL — Optional URL to navigate to before retrieving HTML, skipped for certain operations.
  • After Execution (required) — Determines whether to close the browser, close just the page/tab, or keep the browser open for reuse after operation completes.

Output shape

A single item containing JSON with the full HTML content of the page, the current page URL, page title, operation metadata, and optionally any additional user-provided data.

If a target URL is provided, the page is navigated to it before capturing HTML. The node returns an object with properties: 'html' (full page HTML string), 'url' (current page URL), 'title' (page title), 'operation', 'connectionMode', 'sessionId', 'tabIndex', 'timestamp', and optionally 'additionalData' and 'cdpEndpoint'. The browser or page is closed or kept open based on 'After Execution' setting.

Examples

Example 1: Fetch HTML from a new Chromium browser

Launch chromium headless browser (default) and retrieve full HTML of a specified URL.

Example 2: Reuse a browser session via CDP

Connect to Chrome via CDP, reuse existing tab if enabled, then get HTML of the current page.

Links

Discussion