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 new(url: impl Into<String>) -> PageObservation
pub fn new(url: impl Into<String>) -> PageObservation
Create a new observation.
Sourcepub fn with_title(self, title: impl Into<String>) -> PageObservation
pub fn with_title(self, title: impl Into<String>) -> PageObservation
Set title.
Sourcepub fn with_description(self, desc: impl Into<String>) -> PageObservation
pub fn with_description(self, desc: impl Into<String>) -> PageObservation
Set description.
Sourcepub fn with_page_type(self, page_type: impl Into<String>) -> PageObservation
pub fn with_page_type(self, page_type: impl Into<String>) -> PageObservation
Set page type.
Sourcepub fn add_element(self, element: InteractiveElement) -> PageObservation
pub fn add_element(self, element: InteractiveElement) -> PageObservation
Add an interactive element.
Sourcepub fn add_form(self, form: FormInfo) -> PageObservation
pub fn add_form(self, form: FormInfo) -> PageObservation
Add a form.
Add a navigation option.
Sourcepub fn suggest_action(self, action: impl Into<String>) -> PageObservation
pub fn suggest_action(self, action: impl Into<String>) -> PageObservation
Add a suggested action.
Sourcepub fn with_screenshot(self, screenshot: impl Into<String>) -> PageObservation
pub fn with_screenshot(self, screenshot: impl Into<String>) -> PageObservation
Set screenshot.
Sourcepub fn with_usage(self, usage: AutomationUsage) -> PageObservation
pub fn with_usage(self, usage: AutomationUsage) -> PageObservation
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<PageObservation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PageObservation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for PageObservation
impl Serialize for PageObservation
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. 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 UnsafeUnpin 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