Struct uiautomation::core::UIElement
source · pub struct UIElement { /* private fields */ }
Expand description
A wrapper for windows IUIAutomationElement
interface.
Exposes methods and properties for a UI Automation element, which represents a UI item.
Implementations§
source§impl UIElement
impl UIElement
sourcepub fn build_updated_cache(
&self,
cache_request: &UICacheRequest
) -> Result<UIElement>
pub fn build_updated_cache( &self, cache_request: &UICacheRequest ) -> Result<UIElement>
Retrieves a new UI Automation element with an updated cache.
sourcepub fn find_first(
&self,
scope: TreeScope,
condition: &UICondition
) -> Result<UIElement>
pub fn find_first( &self, scope: TreeScope, condition: &UICondition ) -> Result<UIElement>
Retrieves the first child or descendant element that matches the specified condition.
sourcepub fn find_first_build_cache(
&self,
scope: TreeScope,
condition: &UICondition,
cache_request: &UICacheRequest
) -> Result<UIElement>
pub fn find_first_build_cache( &self, scope: TreeScope, condition: &UICondition, cache_request: &UICacheRequest ) -> Result<UIElement>
Retrieves the first child or descendant element that matches the specified condition, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.
sourcepub fn find_all(
&self,
scope: TreeScope,
condition: &UICondition
) -> Result<Vec<UIElement>>
pub fn find_all( &self, scope: TreeScope, condition: &UICondition ) -> Result<Vec<UIElement>>
Returns all UI Automation elements that satisfy the specified condition.
sourcepub fn find_all_build_cache(
&self,
scope: TreeScope,
condition: &UICondition,
cache_request: &UICacheRequest
) -> Result<Vec<UIElement>>
pub fn find_all_build_cache( &self, scope: TreeScope, condition: &UICondition, cache_request: &UICacheRequest ) -> Result<Vec<UIElement>>
Returns all UI Automation elements that satisfy the specified condition, prefetches the requested properties and control patterns, and stores the prefetched items in the cache.
sourcepub fn get_runtime_id(&self) -> Result<Vec<i32>>
pub fn get_runtime_id(&self) -> Result<Vec<i32>>
Receives the runtime ID as a vec of integers.
sourcepub fn get_cached_name(&self) -> Result<String>
pub fn get_cached_name(&self) -> Result<String>
Retrieves the cached name of the element.
sourcepub fn get_automation_id(&self) -> Result<String>
pub fn get_automation_id(&self) -> Result<String>
Retrieves the Microsoft UI Automation identifier of the element.
sourcepub fn get_cached_automation_id(&self) -> Result<String>
pub fn get_cached_automation_id(&self) -> Result<String>
Retrieves the cached Microsoft UI Automation identifier of the element.
sourcepub fn get_process_id(&self) -> Result<i32>
pub fn get_process_id(&self) -> Result<i32>
Retrieves the identifier of the process that hosts the element.
sourcepub fn get_cached_process_id(&self) -> Result<i32>
pub fn get_cached_process_id(&self) -> Result<i32>
Retrieves the cached ID of the process that hosts the element.
sourcepub fn get_classname(&self) -> Result<String>
pub fn get_classname(&self) -> Result<String>
Retrieves the class name of the element.
sourcepub fn get_cached_classname(&self) -> Result<String>
pub fn get_cached_classname(&self) -> Result<String>
Retrieves the cached class name of the element.
sourcepub fn get_control_type(&self) -> Result<ControlType>
pub fn get_control_type(&self) -> Result<ControlType>
Retrieves the control type of the element.
sourcepub fn get_cached_control_type(&self) -> Result<ControlType>
pub fn get_cached_control_type(&self) -> Result<ControlType>
Retrieves the cached control type of the element.
sourcepub fn get_localized_control_type(&self) -> Result<String>
pub fn get_localized_control_type(&self) -> Result<String>
Retrieves a localized description of the control type of the element.
sourcepub fn get_cached_localized_control_type(&self) -> Result<String>
pub fn get_cached_localized_control_type(&self) -> Result<String>
Retrieves cached localized description of the control type of the element.
sourcepub fn get_accelerator_key(&self) -> Result<String>
pub fn get_accelerator_key(&self) -> Result<String>
Retrieves the accelerator key for the element.
sourcepub fn get_cached_accelerator_key(&self) -> Result<String>
pub fn get_cached_accelerator_key(&self) -> Result<String>
Retrieves the cached accelerator key for the element.
sourcepub fn get_access_key(&self) -> Result<String>
pub fn get_access_key(&self) -> Result<String>
Retrieves the access key character for the element.
sourcepub fn get_cached_access_key(&self) -> Result<String>
pub fn get_cached_access_key(&self) -> Result<String>
Retrieves the cached access key character for the element.
sourcepub fn has_keyboard_focus(&self) -> Result<bool>
pub fn has_keyboard_focus(&self) -> Result<bool>
Indicates whether the element has keyboard focus.
sourcepub fn has_cached_keyboard_focus(&self) -> Result<bool>
pub fn has_cached_keyboard_focus(&self) -> Result<bool>
A cached value that indicates whether the element has keyboard focus.
sourcepub fn is_keyboard_focusable(&self) -> Result<bool>
pub fn is_keyboard_focusable(&self) -> Result<bool>
Indicates whether the element can accept keyboard focus.
sourcepub fn is_cached_keyboard_focusable(&self) -> Result<bool>
pub fn is_cached_keyboard_focusable(&self) -> Result<bool>
A cached value that indicates whether the element can accept keyboard focus.
sourcepub fn is_enabled(&self) -> Result<bool>
pub fn is_enabled(&self) -> Result<bool>
Indicates whether the element is enabled.
sourcepub fn is_cached_enabled(&self) -> Result<bool>
pub fn is_cached_enabled(&self) -> Result<bool>
A cached value that indicates whether the element is enabled.
sourcepub fn get_help_text(&self) -> Result<String>
pub fn get_help_text(&self) -> Result<String>
Retrieves the help text for the element.
sourcepub fn get_cached_help_text(&self) -> Result<String>
pub fn get_cached_help_text(&self) -> Result<String>
Retrieves the cached help text for the element.
sourcepub fn get_culture(&self) -> Result<i32>
pub fn get_culture(&self) -> Result<i32>
Retrieves the culture identifier for the element.
sourcepub fn get_cached_culture(&self) -> Result<i32>
pub fn get_cached_culture(&self) -> Result<i32>
Retrieves the cached culture identifier for the element.
sourcepub fn is_control_element(&self) -> Result<bool>
pub fn is_control_element(&self) -> Result<bool>
Indicates whether the element is a control element.
sourcepub fn is_cached_control_element(&self) -> Result<bool>
pub fn is_cached_control_element(&self) -> Result<bool>
A cached value that indicates whether the element is a control element.
sourcepub fn is_content_element(&self) -> Result<bool>
pub fn is_content_element(&self) -> Result<bool>
Indicates whether the element is a content element.
sourcepub fn is_cached_content_element(&self) -> Result<bool>
pub fn is_cached_content_element(&self) -> Result<bool>
A cached value that indicates whether the element is a content element.
sourcepub fn is_password(&self) -> Result<bool>
pub fn is_password(&self) -> Result<bool>
Indicates whether the element contains a disguised password.
sourcepub fn is_cached_password(&self) -> Result<bool>
pub fn is_cached_password(&self) -> Result<bool>
A cached value that indicates whether the element contains a disguised password.
sourcepub fn get_native_window_handle(&self) -> Result<Handle>
pub fn get_native_window_handle(&self) -> Result<Handle>
Retrieves the window handle of the element.
sourcepub fn get_cached_native_window_handle(&self) -> Result<Handle>
pub fn get_cached_native_window_handle(&self) -> Result<Handle>
Retrieves the cached window handle of the element.
sourcepub fn get_item_type(&self) -> Result<String>
pub fn get_item_type(&self) -> Result<String>
Retrieves a description of the type of UI item represented by the element.
sourcepub fn get_cached_item_type(&self) -> Result<String>
pub fn get_cached_item_type(&self) -> Result<String>
Retrieves a cached description of the type of UI item represented by the element.
sourcepub fn is_offscreen(&self) -> Result<bool>
pub fn is_offscreen(&self) -> Result<bool>
Indicates whether the element is off-screen.
sourcepub fn is_cached_offscreen(&self) -> Result<bool>
pub fn is_cached_offscreen(&self) -> Result<bool>
A cached value that indicates whether the element is off-screen.
sourcepub fn get_orientation(&self) -> Result<OrientationType>
pub fn get_orientation(&self) -> Result<OrientationType>
Retrieves a value that indicates the orientation of the element.
sourcepub fn get_cached_orientation(&self) -> Result<OrientationType>
pub fn get_cached_orientation(&self) -> Result<OrientationType>
Retrieves a cached value that indicates the orientation of the element.
sourcepub fn get_framework_id(&self) -> Result<String>
pub fn get_framework_id(&self) -> Result<String>
Retrieves the name of the underlying UI framework.
sourcepub fn get_cached_framework_id(&self) -> Result<String>
pub fn get_cached_framework_id(&self) -> Result<String>
Retrieves the cached name of the underlying UI framework.
sourcepub fn is_required_for_form(&self) -> Result<bool>
pub fn is_required_for_form(&self) -> Result<bool>
Indicates whether the element is required to be filled out on a form.
sourcepub fn is_cached_required_for_form(&self) -> Result<bool>
pub fn is_cached_required_for_form(&self) -> Result<bool>
A cached value that indicates whether the element is required to be filled out on a form.
sourcepub fn is_data_valid_for_form(&self) -> Result<bool>
pub fn is_data_valid_for_form(&self) -> Result<bool>
Indicates whether the element contains valid data for a form.
sourcepub fn is_cached_data_valid_for_form(&self) -> Result<bool>
pub fn is_cached_data_valid_for_form(&self) -> Result<bool>
A cached value that indicates whether the element contains valid data for a form.
sourcepub fn get_item_status(&self) -> Result<String>
pub fn get_item_status(&self) -> Result<String>
Retrieves the description of the status of an item in an element.
sourcepub fn get_cached_item_status(&self) -> Result<String>
pub fn get_cached_item_status(&self) -> Result<String>
Retrieves the cached description of the status of an item in an element.
sourcepub fn get_bounding_rectangle(&self) -> Result<Rect>
pub fn get_bounding_rectangle(&self) -> Result<Rect>
Retrieves the coordinates of the rectangle that completely encloses the element.
sourcepub fn get_cached_bounding_rectangle(&self) -> Result<Rect>
pub fn get_cached_bounding_rectangle(&self) -> Result<Rect>
Retrieves the cached coordinates of the rectangle that completely encloses the element.
sourcepub fn get_labeled_by(&self) -> Result<UIElement>
pub fn get_labeled_by(&self) -> Result<UIElement>
Retrieves the element that contains the text label for this element.
sourcepub fn get_cached_labeled_by(&self) -> Result<UIElement>
pub fn get_cached_labeled_by(&self) -> Result<UIElement>
Retrieves the cached element that contains the text label for this element.
sourcepub fn get_controller_for(&self) -> Result<Vec<UIElement>>
pub fn get_controller_for(&self) -> Result<Vec<UIElement>>
Retrieves an array of elements for which this element serves as the controller.
sourcepub fn get_cached_controller_for(&self) -> Result<Vec<UIElement>>
pub fn get_cached_controller_for(&self) -> Result<Vec<UIElement>>
Retrieves a cached array of elements for which this element serves as the controller.
sourcepub fn get_described_by(&self) -> Result<Vec<UIElement>>
pub fn get_described_by(&self) -> Result<Vec<UIElement>>
Retrieves an array of elements that describe this element.
sourcepub fn get_cached_described_by(&self) -> Result<Vec<UIElement>>
pub fn get_cached_described_by(&self) -> Result<Vec<UIElement>>
Retrieves a cached array of elements that describe this element.
sourcepub fn get_flows_to(&self) -> Result<Vec<UIElement>>
pub fn get_flows_to(&self) -> Result<Vec<UIElement>>
Retrieves an array of elements that indicates the reading order after the current element.
sourcepub fn get_cached_flows_to(&self) -> Result<Vec<UIElement>>
pub fn get_cached_flows_to(&self) -> Result<Vec<UIElement>>
Retrieves a cached array of elements that indicates the reading order after the current element.
sourcepub fn get_provider_description(&self) -> Result<String>
pub fn get_provider_description(&self) -> Result<String>
Retrieves a description of the provider for this element.
sourcepub fn get_cached_provider_description(&self) -> Result<String>
pub fn get_cached_provider_description(&self) -> Result<String>
Retrieves a cached description of the provider for this element.
sourcepub fn get_pattern<T: UIPattern + TryFrom<IUnknown, Error = Error>>(
&self
) -> Result<T>
pub fn get_pattern<T: UIPattern + TryFrom<IUnknown, Error = Error>>( &self ) -> Result<T>
Retrieves the control pattern interface of the specified pattern <T>
from this UI Automation element.
sourcepub fn get_cached_pattern<T: UIPattern + TryFrom<IUnknown, Error = Error>>(
&self
) -> Result<T>
pub fn get_cached_pattern<T: UIPattern + TryFrom<IUnknown, Error = Error>>( &self ) -> Result<T>
Retrieves the cached control pattern interface of the specified pattern <T>
from this UI Automation element.
sourcepub fn get_clickable_point(&self) -> Result<Option<Point>>
pub fn get_clickable_point(&self) -> Result<Option<Point>>
Retrieves a point on the element that can be clicked.
sourcepub fn get_property_value(&self, property: UIProperty) -> Result<Variant>
pub fn get_property_value(&self, property: UIProperty) -> Result<Variant>
Retrieves the current value of a property for this UI Automation element.
sourcepub fn get_cached_property_value(&self, property: UIProperty) -> Result<Variant>
pub fn get_cached_property_value(&self, property: UIProperty) -> Result<Variant>
Retrieves the cached value of a property for this UI Automation element.
Programmatically invokes a context menu on the target element.
sourcepub fn send_keys(&self, keys: &str, interval: u64) -> Result<()>
pub fn send_keys(&self, keys: &str, interval: u64) -> Result<()>
Simulates typing keys
on keyboard.
{}
is used for some special keys. For example: {ctrl}{alt}{delete}
, {shift}{home}
.
()
is used for group keys. For example: {ctrl}(AB)
types Ctrl+A+B
.
{}()
can be quoted by {}
. For example: {{}Hi,{(}rust!{)}{}}
types {Hi,(rust)}
.
interval
is the milliseconds between keys. 0
is the default value.
§Examples
use uiautomation::core::UIAutomation;
let automation = UIAutomation::new().unwrap();
let root = automation.get_root_element().unwrap();
root.send_keys("{Win}D", 0).unwrap();
sourcepub fn hold_send_keys(
&self,
holdkeys: &str,
keys: &str,
interval: u64
) -> Result<()>
pub fn hold_send_keys( &self, holdkeys: &str, keys: &str, interval: u64 ) -> Result<()>
Simulates holding holdkeys
on keyboard, then sending keys
.
The key format is the same with send_keys()
.
§Examples
use uiautomation::core::UIAutomation;
let automation = UIAutomation::new().unwrap();
let root = automation.get_root_element().unwrap();
root.hold_send_keys("{Win}", "P", 0).unwrap();
sourcepub fn hold_click(&self, holdkeys: &str) -> Result<()>
pub fn hold_click(&self, holdkeys: &str) -> Result<()>
Simulates mouse left click event with holdkeys on the element.
The holdkey is quoted by {}
, for example: {Ctrl}
, {Ctrl}{Shift}
.
sourcepub fn double_click(&self) -> Result<()>
pub fn double_click(&self) -> Result<()>
Simulates mouse double click event on the element.
sourcepub fn right_click(&self) -> Result<()>
pub fn right_click(&self) -> Result<()>
Simulates mouse right click event on the element.