pub struct DomTree {
pub root: AriaNode,
pub selectors: Vec<String>,
pub iframe_indices: Vec<usize>,
}Expand description
Represents the ARIA snapshot of a web page Based on Playwright’s AriaSnapshot structure
Fields§
§root: AriaNodeRoot AriaNode (usually a fragment)
selectors: Vec<String>Array of CSS selectors indexed by element index
iframe_indices: Vec<usize>List of iframe indices (for multi-frame snapshots)
Implementations§
Source§impl DomTree
impl DomTree
Sourcepub fn from_tab_with_prefix(tab: &Arc<Tab>, _ref_prefix: &str) -> Result<Self>
pub fn from_tab_with_prefix(tab: &Arc<Tab>, _ref_prefix: &str) -> Result<Self>
Build DOM tree from a browser tab with a ref prefix (for iframe handling)
Sourcepub fn get_selector(&self, index: usize) -> Option<&String>
pub fn get_selector(&self, index: usize) -> Option<&String>
Get CSS selector for a given index
Sourcepub fn interactive_indices(&self) -> Vec<usize>
pub fn interactive_indices(&self) -> Vec<usize>
Get all interactive element indices
Sourcepub fn count_nodes(&self) -> usize
pub fn count_nodes(&self) -> usize
Count total nodes in the tree
Sourcepub fn count_interactive(&self) -> usize
pub fn count_interactive(&self) -> usize
Count interactive elements (elements with indices)
Sourcepub fn find_node_by_index(&self, index: usize) -> Option<&AriaNode>
pub fn find_node_by_index(&self, index: usize) -> Option<&AriaNode>
Find node by index
Sourcepub fn find_node_by_index_mut(&mut self, index: usize) -> Option<&mut AriaNode>
pub fn find_node_by_index_mut(&mut self, index: usize) -> Option<&mut AriaNode>
Find node by index (mutable)
Sourcepub fn get_iframe_indices(&self) -> &[usize]
pub fn get_iframe_indices(&self) -> &[usize]
Get all iframe indices for multi-frame snapshot handling
Sourcepub fn inject_iframe_content(
&mut self,
iframe_index: usize,
iframe_snapshot: DomTree,
)
pub fn inject_iframe_content( &mut self, iframe_index: usize, iframe_snapshot: DomTree, )
Replace an iframe node’s children with content from another snapshot Used for multi-frame snapshot assembly
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DomTree
impl RefUnwindSafe for DomTree
impl Send for DomTree
impl Sync for DomTree
impl Unpin for DomTree
impl UnwindSafe for DomTree
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