Playwright icon

Playwright

Automate browser actions using Playwright

Overview

This node automates browser actions using the Playwright library, specifically focusing on taking screenshots of web pages. It launches a browser instance (Chromium, Firefox, or Webkit), navigates to a specified URL, and captures a screenshot according to user-defined options. This is useful for monitoring website appearance, generating visual reports, or archiving webpage states.

Practical examples:

  • Automatically capture daily screenshots of a homepage to track design changes.
  • Generate thumbnails of URLs submitted by users.
  • Take full-page screenshots for documentation or testing purposes.

Properties

Name Meaning
URL The web address to navigate to before taking the screenshot.
Property Name The name of the binary property where the screenshot image data will be stored in the output.
Browser The browser engine to use: Chromium, Firefox, or Webkit.
Browser Launch Options Options for launching the browser:
- Headless: Run browser without UI (true/false).
- Slow Motion: Delay operations by specified milliseconds.
Screenshot Options Options for capturing the screenshot:
- Full Page: Capture entire scrollable page (true/false).
- Path: File path to save the screenshot locally (optional).

Output

The node outputs an array with one item per input. Each output item contains a json field with operation results. For the "Take Screenshot" operation, the screenshot image is stored as binary data under the user-defined property name (default "screenshot"). This binary data represents the captured image file (e.g., PNG).

If a file path is provided in the screenshot options, the screenshot is also saved locally at that location.

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 running Playwright and launching browsers.

Troubleshooting

  • Browser launch errors: If the browser executable path cannot be found, the node attempts to install the required browser automatically. Ensure the environment has internet access and permissions to download and install browsers.
  • Timeouts or navigation failures: The target URL might be unreachable or slow to load. Verify the URL correctness and network connectivity.
  • File path issues: If specifying a local path to save the screenshot, ensure the path is writable and valid.
  • Binary property missing: Make sure the "Property Name" is set correctly to store the screenshot data.

Links and References

Discussion