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
impl UIAutomation
sourcepub fn new() -> Result<UIAutomation>
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
.
sourcepub fn new_direct() -> Result<UIAutomation>
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.
sourcepub fn compare_elements(
&self,
element1: &UIElement,
element2: &UIElement
) -> Result<bool>
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.
sourcepub fn element_from_handle(&self, hwnd: Handle) -> Result<UIElement>
pub fn element_from_handle(&self, hwnd: Handle) -> Result<UIElement>
Retrieves a UI Automation element for the specified window.
sourcepub fn element_from_handle_build_cache(
&self,
hwnd: Handle,
cache_request: &UICacheRequest
) -> Result<UIElement>
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.
sourcepub fn element_from_point(&self, point: Point) -> Result<UIElement>
pub fn element_from_point(&self, point: Point) -> Result<UIElement>
Retrieves the UI Automation element at the specified point on the desktop.
sourcepub fn element_from_point_build_cache(
&self,
point: Point,
cache_request: &UICacheRequest
) -> Result<UIElement>
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.
sourcepub fn get_focused_element(&self) -> Result<UIElement>
pub fn get_focused_element(&self) -> Result<UIElement>
Retrieves the UI Automation element that has the input focus.
sourcepub fn get_focused_element_build_cache(
&self,
cache_request: &UICacheRequest
) -> Result<UIElement>
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.
sourcepub fn get_root_element(&self) -> Result<UIElement>
pub fn get_root_element(&self) -> Result<UIElement>
Retrieves the UI Automation element that represents the desktop.
sourcepub fn get_root_element_build_cache(
&self,
cache_request: &UICacheRequest
) -> Result<UIElement>
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.
sourcepub fn create_tree_walker(&self) -> Result<UITreeWalker>
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());
sourcepub fn filter_tree_walker(&self, condition: UICondition) -> Result<UITreeWalker>
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.
sourcepub fn get_raw_view_walker(&self) -> Result<UITreeWalker>
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.
sourcepub fn get_control_view_condition(&self) -> Result<UICondition>
pub fn get_control_view_condition(&self) -> Result<UICondition>
Retrieves a predefined UICondition that selects control elements.
sourcepub fn get_control_view_walker(&self) -> Result<UITreeWalker>
pub fn get_control_view_walker(&self) -> Result<UITreeWalker>
Retrieves a predefined UITreeWalker interface that selects control elements.
sourcepub fn get_content_view_condition(&self) -> Result<UICondition>
pub fn get_content_view_condition(&self) -> Result<UICondition>
Retrieves a predefined UICondition that selects content elements.
sourcepub fn get_content_view_walker(&self) -> Result<UITreeWalker>
pub fn get_content_view_walker(&self) -> Result<UITreeWalker>
Retrieves a UITreeWalker interface used to discover content elements.
sourcepub fn create_matcher(&self) -> UIMatcher
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!")
}
sourcepub fn create_true_condition(&self) -> Result<UICondition>
pub fn create_true_condition(&self) -> Result<UICondition>
Retrieves a predefined condition that selects all elements.
sourcepub fn create_false_condition(&self) -> Result<UICondition>
pub fn create_false_condition(&self) -> Result<UICondition>
Creates a condition that is always false.
sourcepub fn create_not_condition(
&self,
condition: UICondition
) -> Result<UICondition>
pub fn create_not_condition( &self, condition: UICondition ) -> Result<UICondition>
Creates a condition that is the negative of a specified condition.
sourcepub fn create_and_condition(
&self,
condition1: UICondition,
condition2: UICondition
) -> Result<UICondition>
pub fn create_and_condition( &self, condition1: UICondition, condition2: UICondition ) -> Result<UICondition>
Creates a condition that selects elements that match both of two conditions.
sourcepub fn create_or_condition(
&self,
condition1: UICondition,
condition2: UICondition
) -> Result<UICondition>
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.
sourcepub fn create_property_condition(
&self,
property: UIProperty,
value: Variant,
flags: Option<PropertyConditionFlags>
) -> Result<UICondition>
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.
sourcepub fn create_cache_request(&self) -> Result<UICacheRequest>
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
impl AsRef<IUIAutomation> for UIAutomation
source§impl Clone for UIAutomation
impl Clone for UIAutomation
source§fn clone(&self) -> UIAutomation
fn clone(&self) -> UIAutomation
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more