Struct uiautomation::core::UIAutomation

source ·
pub struct UIAutomation { /* private fields */ }
Expand description

A wrapper for windows IUIAutomation interface.

Exposes methods that enable Microsoft UI Automation client applications to discover, access, and filter UI Automation elements.

Implementations§

source§

impl UIAutomation

source

pub fn new() -> Result<UIAutomation>

Creates a uiautomation client instance.

This method initializes the COM library each time, sets the thread’s concurrency model as COINIT_MULTITHREADED.

source

pub fn new_direct() -> Result<UIAutomation>

Creates a uiautomation client instance without initializing the COM library.

The COM library should be initialized manually before invoking.

source

pub fn compare_elements( &self, element1: &UIElement, element2: &UIElement ) -> Result<bool>

Compares two UI Automation elements to determine whether they represent the same underlying UI element.

source

pub fn element_from_handle(&self, hwnd: Handle) -> Result<UIElement>

Retrieves a UI Automation element for the specified window.

source

pub fn element_from_handle_build_cache( &self, hwnd: Handle, cache_request: &UICacheRequest ) -> Result<UIElement>

Retrieves a UI Automation element for the specified window, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.

source

pub fn element_from_point(&self, point: Point) -> Result<UIElement>

Retrieves the UI Automation element at the specified point on the desktop.

source

pub fn element_from_point_build_cache( &self, point: Point, cache_request: &UICacheRequest ) -> Result<UIElement>

Retrieves the UI Automation element at the specified point on the desktop, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.

source

pub fn get_focused_element(&self) -> Result<UIElement>

Retrieves the UI Automation element that has the input focus.

source

pub fn get_focused_element_build_cache( &self, cache_request: &UICacheRequest ) -> Result<UIElement>

Retrieves the UI Automation element that has the input focus, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.

source

pub fn get_root_element(&self) -> Result<UIElement>

Retrieves the UI Automation element that represents the desktop.

source

pub fn get_root_element_build_cache( &self, cache_request: &UICacheRequest ) -> Result<UIElement>

Retrieves the UI Automation element that represents the desktop, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.

source

pub fn create_tree_walker(&self) -> Result<UITreeWalker>

Retrieves a tree walker object that can be used to traverse the Microsoft UI Automation tree.

§Examples
use uiautomation::UIAutomation;
 
let automation = UIAutomation::new().unwrap();
let root = automation.get_root_element().unwrap();
let walker = automation.create_tree_walker().unwrap();
let child = walker.get_first_child(&root);
assert!(child.is_ok());
source

pub fn filter_tree_walker(&self, condition: UICondition) -> Result<UITreeWalker>

Retrieves a filtered tree walker object that can be used to traverse the Microsoft UI Automation tree.

source

pub fn get_raw_view_walker(&self) -> Result<UITreeWalker>

Retrieves a tree walker object used to traverse an unfiltered view of the Microsoft UI Automation tree.

source

pub fn get_control_view_condition(&self) -> Result<UICondition>

Retrieves a predefined UICondition that selects control elements.

source

pub fn get_control_view_walker(&self) -> Result<UITreeWalker>

Retrieves a predefined UITreeWalker interface that selects control elements.

source

pub fn get_content_view_condition(&self) -> Result<UICondition>

Retrieves a predefined UICondition that selects content elements.

source

pub fn get_content_view_walker(&self) -> Result<UITreeWalker>

Retrieves a UITreeWalker interface used to discover content elements.

source

pub fn create_matcher(&self) -> UIMatcher

Creates a UIMatcher which helps to find some UIElement.

§Examples
use uiautomation::UIAutomation;
 
let automation = UIAutomation::new().unwrap();
let matcher = automation.create_matcher().depth(3).timeout(1000).classname("Start");
if let Ok(start_menu) = matcher.find_first() {
    println!("Found startmenu!")
}
source

pub fn create_true_condition(&self) -> Result<UICondition>

Retrieves a predefined condition that selects all elements.

source

pub fn create_false_condition(&self) -> Result<UICondition>

Creates a condition that is always false.

source

pub fn create_not_condition( &self, condition: UICondition ) -> Result<UICondition>

Creates a condition that is the negative of a specified condition.

source

pub fn create_and_condition( &self, condition1: UICondition, condition2: UICondition ) -> Result<UICondition>

Creates a condition that selects elements that match both of two conditions.

source

pub fn create_or_condition( &self, condition1: UICondition, condition2: UICondition ) -> Result<UICondition>

Creates a combination of two conditions where a match exists if either of the conditions is true.

source

pub fn create_property_condition( &self, property: UIProperty, value: Variant, flags: Option<PropertyConditionFlags> ) -> Result<UICondition>

Creates a condition that selects elements that have a property with the specified value, using optional flags.

source

pub fn create_cache_request(&self) -> Result<UICacheRequest>

Creates a UICacheRequest object that specifies the properties and control patterns to be cached for an element.

Trait Implementations§

source§

impl AsRef<IUIAutomation> for UIAutomation

source§

fn as_ref(&self) -> &IUIAutomation

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for UIAutomation

source§

fn clone(&self) -> UIAutomation

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for UIAutomation

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<IUIAutomation> for UIAutomation

source§

fn from(automation: IUIAutomation) -> Self

Converts to this type from the input type.
source§

impl Into<IUIAutomation> for UIAutomation

source§

fn into(self) -> IUIAutomation

Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.