pub use crate::imp::page::{AccessibilitySnapshotResponse as SnapshotResponse, Mixed, Val};
use crate::{
api::ElementHandle,
imp::{
core::*,
page::{AccessibilitySnapshotArgs as SnapshotArgs, Page as PageImpl},
prelude::*
}
};
#[derive(Debug, Clone)]
pub struct Accessibility {
inner: Weak<PageImpl>
}
impl Accessibility {
pub(crate) fn new(inner: Weak<PageImpl>) -> Self { Self { inner } }
pub fn snapshot_builder(&self) -> SnapshotBuilder { SnapshotBuilder::new(self.inner.clone()) }
}
pub struct SnapshotBuilder {
inner: Weak<PageImpl>,
args: SnapshotArgs
}
impl SnapshotBuilder {
fn new(inner: Weak<PageImpl>) -> Self {
let args = SnapshotArgs::default();
Self { inner, args }
}
pub async fn snapshot(self) -> ArcResult<Option<SnapshotResponse>> {
let Self { inner, args } = self;
upgrade(&inner)?.accessibility_snapshot(args).await
}
pub fn try_root(mut self, x: ElementHandle) -> Result<Self, Error> {
let guid = x.guid()?;
self.args.root = Some(OnlyGuid { guid });
Ok(self)
}
setter!(
interesting_only: Option<bool>
);
pub fn clear_root(mut self) -> Self {
self.args.root = None;
self
}
}