Observe
Get candidate DOM elements for actions.
observe()
is used to get a list of actions that can be taken on the current page. It’s useful for adding context to your planning step, or if you unsure of what page you’re on.
observe()
returns an array of objects, each with an XPath selector
and short description
.
If you are looking for a specific element, you can also pass in an instruction to observe via: observe({ instruction: "your instruction"})
.
Observe can also return a suggested action for the candidate element by setting the returnAction
option to true. Here is a sample ObserveResult
:
Arguments: ObserveOptions
Provides instructions for the observation. Defaults to “Find actions that can be performed on this page.”
Returns an observe result object that contains a suggested action for the candidate element. The suggestion includes method, and arguments (if any). Defaults to false.
If true, returns only visible elements. Uses DOM inspection instead of accessibility trees. Defaults to false.
[Deprecated] Previously used for accessibility tree observation. Use onlyVisible: false
instead.
Specifies the model to use
Configuration options for the model client
[Deprecated] Previously used to control vision-based processing. Vision processing is now always enabled.
Timeout in milliseconds for waiting for the DOM to settle
Returns: Promise<ObserveResult[]>
Each ObserveResult
object contains a selector
and description
.
A string representing the element selector
A string describing the possible action
If the returnAction
option is set to true, the following fields will be included in the result.
The method to call on the element
The arguments to pass to the method