Playwright icon

Playwright

Automate browser actions using Playwright

Overview

This node automates browser actions using the Playwright library. It allows users to programmatically control a web browser to perform tasks such as clicking elements, filling forms, navigating to URLs, taking screenshots, extracting text, or running custom Playwright scripts. This is useful for web scraping, automated testing, UI interaction automation, and data extraction from websites.

For example, you can use this node to:

  • Click a "Submit" button on a webpage after loading it.
  • Fill out and submit a form automatically.
  • Extract text content from a specific element on a page.
  • Take a screenshot of a webpage for visual verification.
  • Run a custom script to perform complex interactions not covered by built-in operations.

Properties

Name Meaning
URL The web address to navigate to before performing the operation.
Selector CSS selector identifying the target element for operations like clicking or filling forms.
Browser The browser engine to use: Chromium, Firefox, or Webkit.
Browser Launch Options Options for launching the browser:
- Headless: run without UI (true/false)
- Slow Motion: delay in ms to slow down actions

Output

The node outputs an array with one item per input item processed. Each output item contains a json object with the result of the performed operation. The exact structure depends on the operation:

  • For Click Element, the output typically confirms the click action was performed; no additional data is returned.
  • For other operations (not requested here), outputs may include extracted text, screenshot binary data, or error information.

If an error occurs and the node is configured to continue on failure, the output will contain an error message along with metadata about the browser type and operating system.

Dependencies

  • Requires the Playwright library installed in the environment.
  • Downloads and installs browser binaries if not already present.
  • No explicit API keys or external services are needed.
  • Node.js environment must support dynamic imports and file system access for browser executables.

Troubleshooting

  • Browser executable path errors: If the node cannot find the browser executable, it attempts to install the required browser automatically. Ensure the environment has internet access and permissions to download and save files.
  • Operation failures: Errors during browser launch or page interaction will be logged. Use the "Continue On Fail" option to handle errors gracefully.
  • Selector issues: Incorrect or missing CSS selectors will cause the click operation to fail. Verify selectors carefully.
  • Headless mode problems: Some websites behave differently in headless mode. Try disabling headless mode via Browser Launch Options if unexpected behavior occurs.

Links and References

Discussion