pub struct DomSnapshot {
pub webview_label: String,
pub elements: Vec<DomElement>,
pub ref_map: BTreeMap<String, String>,
}Expand description
A point-in-time snapshot of the DOM accessible tree from a specific webview.
Fields§
§webview_label: StringLabel of the webview this snapshot was taken from.
elements: Vec<DomElement>Top-level accessible elements in the DOM tree.
ref_map: BTreeMap<String, String>Maps ref IDs to CSS selectors for element lookup.
Implementations§
Source§impl DomSnapshot
impl DomSnapshot
Sourcepub fn to_accessible_text(&self, indent: usize) -> String
pub fn to_accessible_text(&self, indent: usize) -> String
Renders the snapshot as indented accessible text (roles, names, and ref handles).
§Examples
use victauri_core::{DomSnapshot, DomElement};
use std::collections::BTreeMap;
let snapshot = DomSnapshot {
webview_label: "main".to_string(),
elements: vec![DomElement {
ref_id: "e1".to_string(),
tag: "button".to_string(),
role: Some("button".to_string()),
name: Some("Submit".to_string()),
text: None,
value: None,
enabled: true,
visible: true,
focusable: true,
bounds: None,
children: vec![],
attributes: BTreeMap::new(),
}],
ref_map: BTreeMap::new(),
};
let text = snapshot.to_accessible_text(0);
assert!(text.contains("button"));
assert!(text.contains("Submit"));
assert!(text.contains("[ref=e1]"));Trait Implementations§
Source§impl Clone for DomSnapshot
impl Clone for DomSnapshot
Source§fn clone(&self) -> DomSnapshot
fn clone(&self) -> DomSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DomSnapshot
impl Debug for DomSnapshot
Source§impl<'de> Deserialize<'de> for DomSnapshot
impl<'de> Deserialize<'de> for DomSnapshot
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
Source§impl PartialEq for DomSnapshot
impl PartialEq for DomSnapshot
Source§fn eq(&self, other: &DomSnapshot) -> bool
fn eq(&self, other: &DomSnapshot) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for DomSnapshot
impl Serialize for DomSnapshot
impl StructuralPartialEq for DomSnapshot
Auto Trait Implementations§
impl Freeze for DomSnapshot
impl RefUnwindSafe for DomSnapshot
impl Send for DomSnapshot
impl Sync for DomSnapshot
impl Unpin for DomSnapshot
impl UnsafeUnpin for DomSnapshot
impl UnwindSafe for DomSnapshot
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