Skip to main content
The page.perform() method executes single, granular actions on a web page. It’s optimized for speed and reliability, using the accessibility tree instead of screenshots.

Overview

Basic Usage

Common Actions

Click Elements

Fill or Type Inputs

Form Interactions

Scrolling

Hover

Keyboard Actions

When to Use perform() vs ai()

Use page.perform()

  • Single, specific actions
  • When you know exactly what action is needed
  • Fast, reliable execution
  • Lower token cost

Use page.ai()

  • Complex multi-step workflows
  • When visual context is needed
  • Tasks requiring decision making
  • When next action depends on page state

Example: Combining Both

Return Value

page.perform() returns a TaskOutput object:

Checking Success

Error Handling

Tips for Writing Effective Instructions

Good: “click the blue ‘Sign Up’ button at the bottom of the form”Bad: “click the button”
Good: “fill the email input in the login form with user@example.comBad: “fill email”
Good: “click the link that says ‘Learn More’”Bad: “click the third link”
Good: “type ‘search query’ into the search box”Bad: “search for something”

CDP Actions

HyperAgent uses Chrome DevTools Protocol (CDP) for precise element interactions by default. This provides:
  • Exact coordinate-based clicks
  • Deep iframe support
  • Auto-filtering of ad frames
To disable CDP and use Playwright locators instead:

Next Steps

page.ai()

Complex multi-step automation

page.extract()

Extract structured data

Action Caching

Record and replay automations