pub struct DomService { /* private fields */ }Expand description
DOM service for extracting and analyzing page content
Implementations§
Source§impl DomService
impl DomService
Sourcepub fn with_browser(self, browser: Arc<Browser>) -> Self
pub fn with_browser(self, browser: Arc<Browser>) -> Self
Sets the browser instance
Sourcepub fn with_cdp_client(self, client: Arc<CdpClient>, session_id: String) -> Self
pub fn with_cdp_client(self, client: Arc<CdpClient>, session_id: String) -> Self
Sets the CDP client and session ID
Sourcepub fn with_target_id(self, target_id: String) -> Self
pub fn with_target_id(self, target_id: String) -> Self
Sets the target ID
Sourcepub async fn extract_page_content(&self, html: &str) -> Result<String>
pub async fn extract_page_content(&self, html: &str) -> Result<String>
Extract page content from HTML
Sourcepub async fn get_dom_tree(
&self,
target_id: Option<&str>,
) -> Result<EnhancedDOMTreeNode>
pub async fn get_dom_tree( &self, target_id: Option<&str>, ) -> Result<EnhancedDOMTreeNode>
Get DOM tree for the current target
Sourcepub async fn get_serialized_dom_tree(
&self,
target_id: Option<&str>,
) -> Result<(SerializedDOMState, EnhancedDOMTreeNode, HashMap<String, f64>)>
pub async fn get_serialized_dom_tree( &self, target_id: Option<&str>, ) -> Result<(SerializedDOMState, EnhancedDOMTreeNode, HashMap<String, f64>)>
Get serialized DOM tree representation for LLM consumption
Sourcepub async fn get_serialized_dom_state(&self) -> Result<SerializedDOMState>
pub async fn get_serialized_dom_state(&self) -> Result<SerializedDOMState>
Get serialized DOM state from browser
Sourcepub async fn get_page_state_string(&self) -> Result<String>
pub async fn get_page_state_string(&self) -> Result<String>
Get page state as string for LLM consumption
Sourcepub async fn get_selector_map(
&self,
) -> Result<HashMap<u32, DOMInteractedElement>>
pub async fn get_selector_map( &self, ) -> Result<HashMap<u32, DOMInteractedElement>>
Get selector map (index -> element mapping)
Sourcepub fn extract_text(&self, html: &str) -> String
pub fn extract_text(&self, html: &str) -> String
Extract text content from HTML
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DomService
impl !RefUnwindSafe for DomService
impl Send for DomService
impl Sync for DomService
impl Unpin for DomService
impl !UnwindSafe for DomService
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more