Actions31
- Account Actions
- Agent Actions
- Browser Actions
- Crawling Actions
- Extract (Legacy) Actions
- Interact Actions
- Map & Search Actions
- Scraping Actions
Browser → Execute browser code
AI-generatedOverview
This node executes custom code within a sandboxed browser environment using a specified browser session. It supports running JavaScript (Node.js), Python, or Bash code to automate browser interactions such as navigation, clicking, typing, and data extraction. This is useful for automating web tasks, scraping data, or testing web applications in an isolated browser session.
Use Case Examples
- Automate login and data extraction from a website by running JavaScript code that navigates pages and extracts content.
- Run Python scripts to interact with complex web pages using Playwright's API.
- Execute shell commands for system-level browser automation tasks via Bash.
Properties
| Name | Meaning |
|---|---|
| Session ID | The unique identifier of the active browser session where the code will be executed. |
| Code | The code snippet to execute in the sandboxed browser environment, using a pre-configured Playwright 'page' object. |
| Language | The programming language of the code to execute, supporting Node.js (JavaScript), Python, or Bash shell commands. |
| Timeout (Seconds) | Maximum allowed execution time for the code before it is forcibly terminated, useful for long-running automations. |
Output
JSON
result- The output or result of the executed code in the browser environment.killed- Boolean flag indicating if the execution was terminated due to timeout.
Dependencies
- Requires an active browser session identified by Session ID, created via a separate 'Create browser session' operation.
- Supports code execution in Node.js, Python, or Bash environments with Playwright or agent-browser CLI.
Troubleshooting
- Ensure the Session ID corresponds to an active and valid browser session; expired or destroyed sessions will cause failures.
- Code execution timeout errors occur if the script runs longer than the specified timeout; increase the timeout for complex tasks.
- Syntax or runtime errors in the provided code will cause execution failures; validate code correctness before running.