Overview
Theobserve() method identifies elements on the page that match a description. It returns an array of Action objects that can be used with act() or inspected directly.
Syntax
Parameters
Natural language description of elements to findIf omitted, returns all interactive elements on the pageExamples:
"buttons on the page""the submit button""all links in the navigation menu""form input fields"
Returns
Array of Action objects representing found elements
Examples
Find All Interactive Elements
Find Specific Elements
Use with act()
Inspect Element Details
Scoped Observation
Find Multiple Element Types
With Custom Model
Multi-page Observation
Real-World Examples
Find and Click Menu Items
Find Form Fields and Fill Them
Validate Page Elements
Extract Links from Section
Find Dynamic Elements
Compare Pages
Best Practices
-
Be specific in descriptions:
-
Check array length before using:
-
Use scoped selectors for efficiency:
-
Combine with act() for reliable workflows:
-
Inspect element properties:
-
Use for validation and testing: