Actions10
Overview
The node provides an interface to interact with browser sessions using the Playwright API. Specifically, the Search DOM operation allows users to search for elements within a webpage's DOM in an active browser session. This is useful for automation workflows where you need to locate elements dynamically based on text content, CSS selectors, or XPath expressions.
Common scenarios include:
- Extracting information from web pages by locating elements containing specific text.
- Automating interactions by finding elements via CSS selectors or XPath before clicking or typing.
- Validating presence or absence of certain elements during automated testing or scraping.
For example, you might use this node to find all buttons with a certain label or to locate a form field by its XPath and then fill it out.
Properties
| Name | Meaning |
|---|---|
| Session ID | ID of the browser session to perform the search in. |
| Selector | CSS selector string used to find elements (optional; depends on search method). |
| Search Method | Method to search elements: Text (search by text content), CSS (search by CSS selector), or XPath (search by XPath expression). |
| Exact Match | Boolean flag indicating whether to match text exactly when searching by text content. |
Output
The output JSON contains the results of the DOM search operation. Typically, this will be an array or collection of elements matching the search criteria, represented as JSON objects describing each found element's properties (such as tag name, attributes, text content, etc.).
If the node supports binary data output for other operations (like screenshots), it would be included under a binary property, but for the Search DOM operation, the output is purely JSON describing matched DOM elements.
Dependencies
- Requires an active Playwright browser session identified by a valid Session ID.
- Needs proper authentication configured in n8n to access the Playwright API (via an API key or token).
- The node depends on the bundled
operationsmodule which implements the actual Playwright interaction logic.
Troubleshooting
- Session ID errors: If the provided Session ID is invalid or expired, the node will fail to find the session. Ensure the session is active and the ID is correct.
- Selector or XPath syntax errors: Invalid CSS selectors or XPath expressions can cause the search to fail or return no results. Validate selectors before use.
- No elements found: If the search returns empty, verify that the page has loaded correctly and the selector/text exists.
- Exact match issues: When using text search, setting "Exact Match" incorrectly may lead to unexpected results. Toggle this option depending on whether partial matches are acceptable.