The Playwright Script node executes browser automation tasks through programmatic code. It provides precise control over browser interactions, element selection, and data processing using JavaScript.

Precise Control

Execute exact browser actions with pixel-perfect accuracy

Advanced Scripting

Use JavaScript for complex automation logic

Element Handling

Interact with DOM elements using selectors and locators

Data Processing

Transform and process extracted data programmatically

Configuration Options

Basic Settings

Script Configuration

The script field contains the JavaScript code for browser automation. Include:

  • Page Navigation: Use page.goto() to navigate to URLs
  • Element Selection: Use locators like page.locator() or page.getByRole()
  • Actions: Implement clicks, form fills, keyboard input, and mouse interactions
  • Data Extraction: Extract text, attributes, and structured data from elements
  • Return: Anything returned will be converted to a string and injected in the state for the ai to analyze.

You can have the AI enter variables in your script using arrows followed by a dot:

<<.PLAYWRIGHT_VARIABLE>>

Example:

// Navigate to form page
await page.goto('/form');

// Fill form with user data
await page.locator('#name').fill(<<.USER_NAME>>);

// Submit form
await page.locator('button[type="submit"]').click();

// Wait for confirmation
await page.waitForSelector('.success-message');

// Transition to next node
await page.waitForTimeout(2000);

Script Environment

Browser Context

Available: Pre-configured browser instance:

  • Chromium browser with stealth mode
  • Page object for DOM interaction
  • Automatic viewport and user agent setup
  • Cookie and session management
  • Code wrapped around an async function for quick building

Playwright & Javascript

Available:

  • Programmatic Workflows - Full programming power for precise automation
  • Advanced Selectors - CSS, XPath, and text-based element targeting
  • Async/Await Support - Modern JavaScript async patterns

Scripts run with full browser access. Ensure proper error handling and timeouts to prevent workflow failures.

Use Cases