// Basic element discoveryconst buttons = await page.observe("find all clickable buttons");const formFields = await page.observe("locate form input fields");// Advanced configurationconst elements = await page.observe({ instruction: "find important call-to-action buttons", modelName: "gpt-4.1-mini", domSettleTimeoutMs: 45000, drawOverlay: true});// Working with resultsconst [loginButton] = await page.observe("find the login button");if (loginButton) { console.log("Found:", loginButton.description); console.log("Selector:", loginButton.selector); await page.act(loginButton); // Execute the action}// Filter resultsconst submitButtons = await page.observe("find all submit buttons");const primarySubmit = submitButtons.find(btn => btn.description.toLowerCase().includes('primary'));// Iframe searchconst iframeElements = await page.observe({ instruction: "find form fields inside the iframe", iframes: true});
# Basic element discoverybuttons = await page.observe("find all clickable buttons")form_fields = await page.observe("locate the form fields")# Advanced configuration elements = await page.observe( instruction="find important call-to-action buttons", model_name="gpt-4.1-mini", dom_settle_timeout_ms=45000)# Working with resultslogin_buttons = await page.observe("find the login button")if login_buttons: button = login_buttons[0] print("Found:", button.description) print("Selector:", button.selector) await page.act(button) # Execute the action# Filter resultssubmit_buttons = await page.observe("find all submit buttons")primary_submit = next(( btn for btn in submit_buttons if 'primary' in btn.description.lower()), None)# Iframe searchiframe_elements = await page.observe( instruction="find the form fields inside the iframe", iframes=True)