Overview
This node, named "Playwright Get DOM Tool," retrieves the current Document Object Model (DOM) content of a web page from an existing browser session managed by Playwright. It is useful in automation workflows where you need to inspect or extract the full HTML structure of a page after navigation or interaction steps have been performed.
Common scenarios include:
- Scraping or analyzing the HTML content of a page dynamically loaded via JavaScript.
- Debugging or verifying the state of a webpage during automated browser testing.
- Feeding the DOM content into further processing nodes such as AI tools for analysis or transformation.
For example, after navigating to a product page on an e-commerce site using a Playwright session, this node can capture the entire DOM to extract product details or check page elements.
Properties
Name | Meaning |
---|---|
Session ID | ID of the browser session to use. This identifies which active Playwright browser session the node should query to get the DOM content. |
Output
The node outputs a JSON string under the response
field containing:
- A success flag (
success: true
) indicating the operation succeeded. - The full DOM content of the current page as a string (
dom
), representing the entire HTML markup at the moment of retrieval.
The output JSON looks like:
{
"success": true,
"dom": "<!DOCTYPE html><html>...</html>"
}
There is no binary data output.
Dependencies
- Requires an active Playwright browser session identified by the provided Session ID.
- Needs credentials for accessing the Playwright API service (an API key or authentication token).
- Depends on internal operations that interface with Playwright to fetch the DOM content.
Troubleshooting
Common issues:
- Invalid or expired Session ID: The node will fail if the specified browser session does not exist or has been closed.
- Missing or incorrect Playwright API credentials: Authentication failures will prevent DOM retrieval.
- Network or connectivity problems with the Playwright service.
Error messages:
"Failed to get DOM state: <error message>"
indicates the node could not retrieve the DOM. Check that the session ID is correct and the Playwright service is reachable.
Resolutions:
- Verify the session ID corresponds to an active Playwright session.
- Ensure valid API credentials are configured.
- Confirm network access to the Playwright API endpoint.
Links and References
- Playwright Official Documentation
- n8n documentation on Using Credentials
- General info on DOM Manipulation and Extraction