Playwright Search DOM Tool icon

Playwright Search DOM Tool

Searches for elements in the DOM

Overview

The "Playwright Search DOM Tool" node enables users to search for elements within a browser's Document Object Model (DOM) using a specified selector. It leverages an existing browser session identified by a session ID and supports different selector methods such as CSS selectors, XPath expressions, or text matching. This node is particularly useful in automation workflows where you need to locate and interact with specific elements on a webpage, for example, scraping data, verifying element presence, or triggering actions based on element states.

Properties

Name Meaning
Session ID The identifier of the active browser session to use for searching elements in the DOM.

Output

The node outputs a JSON string containing the result of the DOM search operation. The structure includes:

  • success: A boolean indicating whether the search was successful.
  • elements: An array of elements found matching the given selector criteria.

This output allows subsequent workflow steps to process the found elements or handle cases where no elements were matched.

Dependencies

  • Requires an active browser session identified by the provided Session ID.
  • Needs valid API credentials for the Playwright service to perform DOM operations.
  • Relies on the Playwright automation framework integrated via the referenced API.

Troubleshooting

  • Common Issues:

    • Invalid or expired Session ID: Ensure the session ID corresponds to an active browser session.
    • Incorrect selector syntax: Verify that the selector string matches the expected format for the chosen method (CSS, XPath, or text).
    • Missing or invalid API credentials: Confirm that the required API authentication token is correctly configured.
  • Error Messages:

    • "Failed to search DOM: <error message>" indicates an issue during the search operation, possibly due to network problems, invalid selectors, or session issues. Review the error details and verify inputs accordingly.

Links and References

Discussion