pub struct PageObservation {
pub url: String,
pub title: String,
pub description: String,
pub page_type: String,
pub interactive_elements: Vec<InteractiveElement>,
pub forms: Vec<FormInfo>,
pub navigation: Vec<NavigationOption>,
pub suggested_actions: Vec<String>,
pub screenshot: Option<String>,
pub usage: AutomationUsage,
pub html: Option<String>,
pub text_content: Option<String>,
}Expand description
Observation of a page’s current state.
Used by the agent to understand what’s on the page and what actions are available.
Fields§
§url: StringCurrent page URL.
title: StringPage title.
description: StringBrief description of the page.
page_type: StringType of page (login, search, product, etc.).
interactive_elements: Vec<InteractiveElement>Interactive elements on the page.
forms: Vec<FormInfo>Forms on the page.
Navigation options.
suggested_actions: Vec<String>Suggested next actions.
screenshot: Option<String>Screenshot (base64).
usage: AutomationUsageToken usage for this observation.
html: Option<String>Raw HTML (truncated).
text_content: Option<String>Page text content.
Implementations§
Source§impl PageObservation
impl PageObservation
Sourcepub fn with_title(self, title: impl Into<String>) -> Self
pub fn with_title(self, title: impl Into<String>) -> Self
Set title.
Sourcepub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
Set description.
Sourcepub fn with_page_type(self, page_type: impl Into<String>) -> Self
pub fn with_page_type(self, page_type: impl Into<String>) -> Self
Set page type.
Sourcepub fn add_element(self, element: InteractiveElement) -> Self
pub fn add_element(self, element: InteractiveElement) -> Self
Add an interactive element.
Add a navigation option.
Sourcepub fn suggest_action(self, action: impl Into<String>) -> Self
pub fn suggest_action(self, action: impl Into<String>) -> Self
Add a suggested action.
Sourcepub fn with_screenshot(self, screenshot: impl Into<String>) -> Self
pub fn with_screenshot(self, screenshot: impl Into<String>) -> Self
Set screenshot.
Sourcepub fn with_usage(self, usage: AutomationUsage) -> Self
pub fn with_usage(self, usage: AutomationUsage) -> Self
Set usage.
Sourcepub fn find_element(&self, selector: &str) -> Option<&InteractiveElement>
pub fn find_element(&self, selector: &str) -> Option<&InteractiveElement>
Find an element by selector.
Sourcepub fn elements_by_type(&self, element_type: &str) -> Vec<&InteractiveElement>
pub fn elements_by_type(&self, element_type: &str) -> Vec<&InteractiveElement>
Find elements by type.
Sourcepub fn clickable_elements(&self) -> Vec<&InteractiveElement>
pub fn clickable_elements(&self) -> Vec<&InteractiveElement>
Get clickable elements.
Sourcepub fn input_elements(&self) -> Vec<&InteractiveElement>
pub fn input_elements(&self) -> Vec<&InteractiveElement>
Get form inputs.
Trait Implementations§
Source§impl Clone for PageObservation
impl Clone for PageObservation
Source§fn clone(&self) -> PageObservation
fn clone(&self) -> PageObservation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PageObservation
impl Debug for PageObservation
Source§impl Default for PageObservation
impl Default for PageObservation
Source§fn default() -> PageObservation
fn default() -> PageObservation
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PageObservation
impl<'de> Deserialize<'de> for PageObservation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PageObservation
impl RefUnwindSafe for PageObservation
impl Send for PageObservation
impl Sync for PageObservation
impl Unpin for PageObservation
impl UnwindSafe for PageObservation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more