Playwright API icon

Playwright API

Interact with Playwright API

Overview

The node provides an interface to interact with browser sessions using the Playwright API. Specifically, for the Session - Get DOM operation, it retrieves the full HTML Document Object Model (DOM) of a web page currently loaded in a specified browser session. This is useful for scenarios where you want to analyze or extract the entire page structure after navigation or interaction.

Practical examples include:

  • Extracting the complete HTML content of a page for further parsing or processing.
  • Verifying that a page has fully loaded by inspecting its DOM.
  • Debugging or logging the current state of a webpage during automated browsing workflows.

Properties

Name Meaning
Session ID ID of the browser session to retrieve the DOM from

This property is required and identifies which active browser session the node should query to get the DOM.

Output

The output contains a JSON object representing the DOM content of the page as a string. The exact structure is typically:

{
  "dom": "<!DOCTYPE html><html>...</html>"
}

Where the dom field holds the full HTML markup of the current page loaded in the session.

No binary data output is produced by this operation.

Dependencies

  • Requires a valid Playwright API credential configured in n8n to authenticate and manage browser sessions.
  • Depends on an active browser session identified by the provided Session ID.
  • The node internally calls Playwright operations implemented in the bundled operations module.

Troubleshooting

  • Common issues:

    • Using an invalid or expired Session ID will cause errors because the session cannot be found.
    • Attempting to get the DOM before the page has fully loaded may return incomplete or empty HTML.
    • Network or authentication issues with the Playwright API credential can prevent session access.
  • Error messages:

    • "The operation \"getDom\" is not supported!" — indicates a misconfiguration or unsupported operation requested.
    • Errors related to session not found or closed sessions usually mean the Session ID is incorrect or the session was terminated.
  • Resolutions:

    • Verify the Session ID is correct and corresponds to an active session.
    • Ensure the page has finished loading before calling Get DOM.
    • Confirm the Playwright API credential is properly set up and authorized.

Links and References

Discussion