This guide walks you through your first Handstage script. By the end you’ll have a working program that launches Chrome, opens a page, interacts with an element, captures a screenshot, and shuts down cleanly.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/l-xiaoshen/handstage/llms.txt
Use this file to discover all available pages before exploring further.
Handstage requires Chrome or Chromium to be installed on your system. On most macOS, Linux, and Windows machines,
V3.connectLocal() finds Chrome automatically. See connecting to Chrome if you need to specify a custom path or port.Launch Chrome
Call If Chrome is already running with remote debugging enabled,
V3.connectLocal() to start a Chrome process and connect to it over CDP. You get back a V3 instance that represents the running browser.V3.connectLocal() can attach to it instead of launching a new process. See connecting to Chrome for details.Open a page
Access the default browser context with
browser.context, then call newPage() with the URL you want to open. This creates a new tab and waits for the page to load.Interact with an element
Use Other available locator actions include
page.locator(selector) to target an element by CSS selector or XPath, then call an action on the returned Locator..type(text) for character-by-character input and .hover() to trigger hover states.Complete example
Here’s the full script putting all the steps together:This example uses top-level
await, which requires "type": "module" in your package.json and "module": "ESNext" (or "NodeNext") in your tsconfig.json. See installation for the full TypeScript configuration.Next steps
Installation
Full setup instructions including TypeScript configuration and environment variables.
Core concepts
Learn how browsers, contexts, pages, and locators relate to each other.
API reference
Complete API reference for the
V3 class.AI agent integration
Give an LLM browser control using
@handstage/agent.