Skip to main content
The Playwright Node runs JavaScript automation in a real browser using the Playwright API. It provides deterministic, fully controllable automation, ideal for tasks requiring precision, repeatability, or logic that is too brittle for natural-language control. Use a Playwright node when you need exact behavior such as element-level actions, structured data extraction, or branching logic.

Precise Control

Execute exact browser interactions

Advanced Scripting

Implement custom automation logic using JavaScript

Element Handling

Target DOM elements using powerful selectors and locators

Data Processing

Extract, transform, and return structured data programmatically

Configuration

Script

The Script field contains the JavaScript that will run inside your workflow’s browser context. Your script can include:
  • Navigation: page.goto() and URL handling
  • Element Selection: page.locator(), page.getByRole(), and other Playwright selectors
  • Actions: clicking, filling, typing, scrolling, keyboard input, etc.
  • Waiting & Synchronization: waitForSelector, waitForLoadState, waitForURL
  • Data Extraction: read text, attributes, collections, or build structured objects
  • Return Values: any returned value is stringified and made available for the next node
The code will be automatically wrapped in a function with this signature:
async function (page: playwright.Page) {
  // Script code will be placed here
}
You can therefore use the page object directly. If it’s useful, you can define subroutines in your code that you can use as helpers. Example script:
// Navigate to form page
await page.goto('/form');

// Fill with Playwright script variables
await page.locator('#name').fill(<<.USER_NAME>>);

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

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

// Optional pause
await page.waitForTimeout(2000);

// Return data for the next node
return "Form submitted successfully";

Variables

You can embed Playwright script variables in your script using: <<.VARIABLE_NAME>>. Each variable must have an associated description and type, so the AI knows what value to insert at runtime.
Playwright Script Variables vs. Dynamic Variables
  • Playwright Script Variables (<<.VARIABLE>>): Used in Playwright scripts. These are prompts for the LLM, which will decide what value to insert based on your variable description.
  • Dynamic Variables ({{.var_name}}): Used in AI Task node instructions. These values are fixed and passed directly into the agent by the user at runtime.
These two syntaxes serve different purposes and cannot be used interchangeably.
To insert credentials in a Playwright script, wrap them in a string and they will be hot-swapped automatically:
await page.getByRole('textbox', { name: 'User Password' }).fill("##PASSWORD##");
Dynamic data vs. Playwright variablesThese two concepts look similar but behave very differently:
  • Dynamic Variables ({{.var_name}}) These values are fixed and passed directly into the workflow by the user at runtime.
  • Playwright Script Variables (<<.VARIABLE>>) These are prompts for the LLM, which will decide what value to insert based on your variable description.

Transitions

Critical: Playwright Nodes Require Outcome Success TransitionsPlaywright nodes can ONLY be connected to the next node using an Outcome Success transition type. This is the only acceptable transition type for Playwright nodes.
  • Playwright nodes cannot use AI Transitions or Selector Transitions
  • If a Playwright node doesn’t have an Outcome Success transition connecting it to the next node, it won’t work properly
  • Always ensure your Playwright node has one Outcome Success transition to continue the workflow
For more details, see Transitions.

Use Cases

Ideal for multi-step forms with conditional branches, dynamic elements, or timing-sensitive validation.
Scrape tables, lists, and multi-page data, then return structured objects for the next node.
Use when the UI is stable, the steps are known, and the AI should not improvise.