Playwright Script
Learn about Playwright script nodes and their automation capabilities
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
Name
Name
Set a descriptive name for your Playwright Script node. This helps identify the node’s purpose in your workflow.
Description
Description
Provide a clear description of what this specific Playwright script will accomplish. This serves as a description for the AI to know how to use your code
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()
orpage.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:
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
Complex Form Automation
Complex Form Automation
Handle multi-step forms with conditional logic, dynamic elements, and validation checks.
Data Scraping
Data Scraping
Extract structured data from complex web pages with pagination, filtering, and data transformation.