Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 1.01 KB

File metadata and controls

33 lines (25 loc) · 1.01 KB
title Execute Playwright Code
description Run Playwright/TypeScript code against a browser session

Use execute_playwright_code to run Playwright/TypeScript automation code against a Kernel browser session. If you provide session_id, it uses that existing browser. If you omit session_id, it creates a browser and cleans it up after execution.

Use computer_action with the screenshot action instead of page.screenshot() in your code. For a comprehensive page state snapshot, use await page._snapshotForAI().

Parameters

Parameter Description
code Playwright/TypeScript code with a page object in scope. Required.
session_id Existing browser session ID. If omitted, a new browser is created and cleaned up after execution.

Example

{
  "code": "await page.goto('https://example.com'); return await page.title();"
}

Returns:

{
  "success": true,
  "result": "Example Domain",
  "replay_url": "https://..."
}