act() allows Stagehand to interact with a web page. Provide an action like "Click on the add to cart button", or "Type 'Browserbase' into the search bar".
You can define variables that will not be shared with LLM providers
act() to perform complex actions. For multi-step actions, use Agent instead
Arguments: ActOptions | ObserveResult
- TypeScript
- Python
ActOptions:Describes the action to perform
Specifies the model to use
Configuration options for the model client
Variables to use in the action. Variables in the action string are referenced using %variable_name%
Set
iframes: true if the target element exists within an iframeTimeout in milliseconds for waiting for the DOM to settle
Timeout in milliseconds for the action being performed.
ObserveResult:A string representing the element selector
A string describing the possible action
The method to call on the element
The arguments to pass to the method
Returns: Promise<ActResult>
If the action was completed successfully
Details about the action’s execution
The action performed

