uiautomation
|
静的公開メンバ関数 | |
'Control' | CreateControlFromElement (element) |
'Control' | CreateControlFromControl ('Control' control) |
公開変数類 | |
searchFromControl | |
searchDepth | |
searchInterval | |
foundIndex | |
searchProperties | |
regexName | |
静的公開変数類 | |
ValidKeys = set(['ControlType', 'ClassName', 'AutomationId', 'Name', 'SubName', 'RegexName', 'Depth', 'Compare']) | |
def uiautomation.uiautomation.Control.__init__ | ( | self, | |
'Control' | searchFromControl = None , |
||
int | searchDepth = 0xFFFFFFFF , |
||
float | searchInterval = SEARCH_INTERVAL , |
||
int | foundIndex = 1 , |
||
element = None , |
|||
** | searchProperties | ||
) |
searchFromControl: `Control` or its subclass, if it is None, search from root control(Desktop). searchDepth: int, max search depth from searchFromControl. foundIndex: int, starts with 1, >= 1. searchInterval: float, wait searchInterval after every search in self.Refind and self.Exists, the global timeout is TIME_OUT_SECOND. element: `ctypes.POINTER(IUIAutomationElement)`, internal use only. searchProperties: defines how to search, the following keys can be used: ControlType: int, a value in class `ControlType`. ClassName: str. AutomationId: str. Name: str. SubName: str, a part str in Name. RegexName: str, supports regex using re.match. You can only use one of Name, SubName, RegexName in searchProperties. Depth: int, only search controls in relative depth from searchFromControl, ignore controls in depth(0~Depth-1), if set, searchDepth will be set to Depth too. Compare: Callable[[Control, int], bool], custom compare function(control: Control, depth: int) -> bool. `Control` wraps IUIAutomationElement. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
'Control' uiautomation.uiautomation.Control.Control | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
str uiautomation.uiautomation.Control.__str__ | ( | self | ) |
str uiautomation.uiautomation.Control.AcceleratorKey | ( | self | ) |
Property AcceleratorKey. Call IUIAutomationElement::get_CurrentAcceleratorKey. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
str uiautomation.uiautomation.Control.AccessKey | ( | self | ) |
Property AccessKey. Call IUIAutomationElement::get_CurrentAccessKey. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
None uiautomation.uiautomation.Control.AddSearchProperties | ( | self, | |
** | searchProperties | ||
) |
Add search properties using `dict.update`. searchProperties: dict, same as searchProperties in `Control.__init__`.
str uiautomation.uiautomation.Control.AriaProperties | ( | self | ) |
Property AriaProperties. Call IUIAutomationElement::get_CurrentAriaProperties. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
str uiautomation.uiautomation.Control.AriaRole | ( | self | ) |
Property AriaRole. Call IUIAutomationElement::get_CurrentAriaRole. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
str uiautomation.uiautomation.Control.AutomationId | ( | self | ) |
Property AutomationId. Call IUIAutomationElement::get_CurrentAutomationId. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
Rect uiautomation.uiautomation.Control.BoundingRectangle | ( | self | ) |
Property BoundingRectangle. Call IUIAutomationElement::get_CurrentBoundingRectangle. Return `Rect`. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentboundingrectangle rect = control.BoundingRectangle print(rect.left, rect.top, rect.right, rect.bottom, rect.width(), rect.height(), rect.xcenter(), rect.ycenter())
'ButtonControl' uiautomation.uiautomation.Control.ButtonControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'CalendarControl' uiautomation.uiautomation.Control.CalendarControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
bool uiautomation.uiautomation.Control.CaptureToImage | ( | self, | |
str | savePath, | ||
int | x = 0 , |
||
int | y = 0 , |
||
int | width = 0 , |
||
int | height = 0 |
||
) |
Capture control to a image file. savePath: str, should end with .bmp, .jpg, .jpeg, .png, .gif, .tif, .tiff. x, y: int, the point in control's internal position(from 0,0). width, height: int, image's width and height from x, y, use 0 for entire area. If width(or height) < 0, image size will be control's width(or height) - width(or height). Return bool, True if succeed otherwise False.
'CheckBoxControl' uiautomation.uiautomation.Control.CheckBoxControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
str uiautomation.uiautomation.Control.ClassName | ( | self | ) |
Property ClassName. Call IUIAutomationElement::get_CurrentClassName. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
None uiautomation.uiautomation.Control.Click | ( | self, | |
int | x = None , |
||
int | y = None , |
||
float | ratioX = 0.5 , |
||
float | ratioY = 0.5 , |
||
bool | simulateMove = True , |
||
float | waitTime = OPERATION_WAIT_TIME |
||
) |
x: int, if < 0, click self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, click self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool, if True, first move cursor to control smoothly. waitTime: float. Click(), Click(ratioX=0.5, ratioY=0.5): click center. Click(10, 10): click left+10, top+10. Click(-10, -10): click right-10, bottom-10.
'ComboBoxControl' uiautomation.uiautomation.Control.ComboBoxControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
int uiautomation.uiautomation.Control.ControlType | ( | self | ) |
Property ControlType. Return int, a value in class `ControlType`. Call IUIAutomationElement::get_CurrentControlType. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
str uiautomation.uiautomation.Control.ControlTypeName | ( | self | ) |
Property ControlTypeName.
Create a concreate `Control` from a control instance, copy it. control: `Control` or its subclass. Return a subclass of `Control`, an instance of the control's real type. For example: if control's ControlType is EditControl, return an EditControl.
|
static |
Create a concreate `Control` from a com type `IUIAutomationElement`. element: `ctypes.POINTER(IUIAutomationElement)`. Return a subclass of `Control`, an instance of the control's real type.
int uiautomation.uiautomation.Control.Culture | ( | self | ) |
Property Culture. Call IUIAutomationElement::get_CurrentCulture. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
'CustomControl' uiautomation.uiautomation.Control.CustomControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'DataGridControl' uiautomation.uiautomation.Control.DataGridControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'DataItemControl' uiautomation.uiautomation.Control.DataItemControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
bool uiautomation.uiautomation.Control.Disappears | ( | self, | |
float | maxSearchSeconds = 5 , |
||
float | searchIntervalSeconds = SEARCH_INTERVAL , |
||
bool | printIfNotDisappear = False |
||
) |
maxSearchSeconds: float searchIntervalSeconds: float Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds. Return bool, True if control disappears.
'DocumentControl' uiautomation.uiautomation.Control.DocumentControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
None uiautomation.uiautomation.Control.DoubleClick | ( | self, | |
int | x = None , |
||
int | y = None , |
||
float | ratioX = 0.5 , |
||
float | ratioY = 0.5 , |
||
bool | simulateMove = True , |
||
float | waitTime = OPERATION_WAIT_TIME |
||
) |
x: int, if < 0, right click self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, right click self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool, if True, first move cursor to control smoothly. waitTime: float. DoubleClick(), DoubleClick(ratioX=0.5, ratioY=0.5): double click center. DoubleClick(10, 10): double click left+10, top+10. DoubleClick(-10, -10): double click right-10, bottom-10.
None uiautomation.uiautomation.Control.DragDrop | ( | self, | |
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
float | moveSpeed = 1 , |
||
float | waitTime = OPERATION_WAIT_TIME |
||
) |
'EditControl' uiautomation.uiautomation.Control.EditControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
def uiautomation.uiautomation.Control.Element | ( | self | ) |
Property Element. Return `ctypes.POINTER(IUIAutomationElement)`.
bool uiautomation.uiautomation.Control.Exists | ( | self, | |
float | maxSearchSeconds = 5 , |
||
float | searchIntervalSeconds = SEARCH_INTERVAL , |
||
bool | printIfNotExist = False |
||
) |
maxSearchSeconds: float searchIntervalSeconds: float Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds. Return bool, True if find
str uiautomation.uiautomation.Control.FrameworkId | ( | self | ) |
Property FrameworkId. Call IUIAutomationElement::get_CurrentFrameworkId. Return str, such as Win32, WPF... Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
'Control' uiautomation.uiautomation.Control.GetAncestorControl | ( | self, | |
Callable[['Control', int], bool] | condition | ||
) |
Get an ancestor control that matches the condition. condition: Callable[[Control, int], bool], function(control: Control, depth: int) -> bool, depth starts with -1 and decreses when search goes up. Return `Control` subclass or None.
def uiautomation.uiautomation.Control.GetCachedPattern | ( | self, | |
int | patternId, | ||
bool | cache | ||
) |
Get a pattern by patternId. patternId: int, a value in class `PatternId`. Return a pattern if it supports the pattern else None. cache: bool, if True, store the pattern for later use, if False, get a new pattern by `self.GetPattern`.
List['Control'] uiautomation.uiautomation.Control.GetChildren | ( | self | ) |
Return List[Control], a list of `Control` subclasses.
Tuple[int, int, bool] uiautomation.uiautomation.Control.GetClickablePoint | ( | self | ) |
Call IUIAutomationElement::GetClickablePoint. Return Tuple[int, int, bool], three items tuple (x, y, gotClickable), such as (20, 10, True) Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
str uiautomation.uiautomation.Control.GetColorfulSearchPropertiesStr | ( | self, | |
keyColor = 'DarkGreen' , |
|||
valueColor = 'DarkCyan' |
|||
) |
keyColor, valueColor: str, color name in class ConsoleColor
'Control' uiautomation.uiautomation.Control.GetFirstChildControl | ( | self | ) |
Return `Control` subclass or None.
'Control' uiautomation.uiautomation.Control.GetLastChildControl | ( | self | ) |
Return `Control` subclass or None.
LegacyIAccessiblePattern uiautomation.uiautomation.Control.GetLegacyIAccessiblePattern | ( | self | ) |
Return `LegacyIAccessiblePattern` if it supports the pattern else None.
'Control' uiautomation.uiautomation.Control.GetNextSiblingControl | ( | self | ) |
Return `Control` subclass or None.
'Control' uiautomation.uiautomation.Control.GetParentControl | ( | self | ) |
Return `Control` subclass or None.
def uiautomation.uiautomation.Control.GetPattern | ( | self, | |
int | patternId | ||
) |
Call IUIAutomationElement::GetCurrentPattern. Get a new pattern by pattern id if it supports the pattern. patternId: int, a value in class `PatternId`. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
def uiautomation.uiautomation.Control.GetPatternAs | ( | self, | |
int | patternId, | ||
riid | |||
) |
Call IUIAutomationElement::GetCurrentPatternAs. Get a new pattern by pattern id if it supports the pattern, todo. patternId: int, a value in class `PatternId`. riid: GUID. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
int uiautomation.uiautomation.Control.GetPixelColor | ( | self, | |
int | x, | ||
int | y | ||
) |
Call native `GetPixelColor` if control has a valid native handle. Use `self.ToBitmap` if control doesn't have a valid native handle or you get many pixels. x: int, internal x position. y: int, internal y position. Return int, a color value in bgr. r = bgr & 0x0000FF g = (bgr & 0x00FF00) >> 8 b = (bgr & 0xFF0000) >> 16
'Control' uiautomation.uiautomation.Control.GetPreviousSiblingControl | ( | self | ) |
Return `Control` subclass or None.
Any uiautomation.uiautomation.Control.GetPropertyValue | ( | self, | |
int | propertyId | ||
) |
Call IUIAutomationElement::GetCurrentPropertyValue. propertyId: int, a value in class `PropertyId`. Return Any, corresponding type according to propertyId. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
Any uiautomation.uiautomation.Control.GetPropertyValueEx | ( | self, | |
int | propertyId, | ||
int | ignoreDefaultValue | ||
) |
Call IUIAutomationElement::GetCurrentPropertyValueEx. propertyId: int, a value in class `PropertyId`. ignoreDefaultValue: int, 0 or 1. Return Any, corresponding type according to propertyId. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
List[int] uiautomation.uiautomation.Control.GetRuntimeId | ( | self | ) |
Call IUIAutomationElement::GetRuntimeId. Return List[int], a list of int. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
str uiautomation.uiautomation.Control.GetSearchPropertiesStr | ( | self | ) |
'Control' uiautomation.uiautomation.Control.GetSiblingControl | ( | self, | |
Callable[['Control'], bool] | condition, | ||
bool | forward = True |
||
) |
Get a sibling control that matches the condition. forward: bool, if True, only search next siblings, if False, search pervious siblings first, then search next siblings. condition: Callable[[Control], bool], function(control: Control) -> bool. Return `Control` subclass or None.
'Control' uiautomation.uiautomation.Control.GetTopLevelControl | ( | self | ) |
Get the top level control which current control lays. If current control is top level, return self. If current control is root control, return None. Return `PaneControl` or `WindowControl` or None.
str uiautomation.uiautomation.Control.GetWindowText | ( | self | ) |
Call native GetWindowText if control has a valid native handle.
'GroupControl' uiautomation.uiautomation.Control.GroupControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
bool uiautomation.uiautomation.Control.HasKeyboardFocus | ( | self | ) |
Property HasKeyboardFocus. Call IUIAutomationElement::get_CurrentHasKeyboardFocus. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
'HeaderControl' uiautomation.uiautomation.Control.HeaderControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'HeaderItemControl' uiautomation.uiautomation.Control.HeaderItemControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
str uiautomation.uiautomation.Control.HelpText | ( | self | ) |
Property HelpText. Call IUIAutomationElement::get_CurrentHelpText. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
bool uiautomation.uiautomation.Control.Hide | ( | self, | |
float | waitTime = OPERATION_WAIT_TIME |
||
) |
Call native `ShowWindow(SW.Hide)`. waitTime: float Return bool, True if succeed otherwise False.
'HyperlinkControl' uiautomation.uiautomation.Control.HyperlinkControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'ImageControl' uiautomation.uiautomation.Control.ImageControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
bool uiautomation.uiautomation.Control.IsContentElement | ( | self | ) |
Property IsContentElement. Call IUIAutomationElement::get_CurrentIsContentElement. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
bool uiautomation.uiautomation.Control.IsControlElement | ( | self | ) |
Property IsControlElement. Call IUIAutomationElement::get_CurrentIsControlElement. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
bool uiautomation.uiautomation.Control.IsDataValidForForm | ( | self | ) |
Property IsDataValidForForm. Call IUIAutomationElement::get_CurrentIsDataValidForForm. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
bool uiautomation.uiautomation.Control.IsEnabled | ( | self | ) |
Property IsEnabled. Call IUIAutomationElement::get_CurrentIsEnabled. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
bool uiautomation.uiautomation.Control.IsKeyboardFocusable | ( | self | ) |
Property IsKeyboardFocusable. Call IUIAutomationElement::get_CurrentIsKeyboardFocusable. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
bool uiautomation.uiautomation.Control.IsOffscreen | ( | self | ) |
Property IsOffscreen. Call IUIAutomationElement::get_CurrentIsOffscreen. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
bool uiautomation.uiautomation.Control.IsPassword | ( | self | ) |
Property IsPassword. Call IUIAutomationElement::get_CurrentIsPassword. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
bool uiautomation.uiautomation.Control.IsRequiredForForm | ( | self | ) |
Property IsRequiredForForm. Call IUIAutomationElement::get_CurrentIsRequiredForForm. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
bool uiautomation.uiautomation.Control.IsTopLevel | ( | self | ) |
Determine whether current control is top level.
str uiautomation.uiautomation.Control.ItemStatus | ( | self | ) |
Property ItemStatus. Call IUIAutomationElement::get_CurrentItemStatus. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
str uiautomation.uiautomation.Control.ItemType | ( | self | ) |
Property ItemType. Call IUIAutomationElement::get_CurrentItemType. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
'listControl' uiautomation.uiautomation.Control.ListControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'ListItemControl' uiautomation.uiautomation.Control.ListItemControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
str uiautomation.uiautomation.Control.LocalizedControlType | ( | self | ) |
Property LocalizedControlType. Call IUIAutomationElement::get_CurrentLocalizedControlType. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
'MenuBarControl' uiautomation.uiautomation.Control.MenuBarControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'MenuControl' uiautomation.uiautomation.Control.MenuControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'MenuItemControl' uiautomation.uiautomation.Control.MenuItemControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
None uiautomation.uiautomation.Control.MiddleClick | ( | self, | |
int | x = None , |
||
int | y = None , |
||
float | ratioX = 0.5 , |
||
float | ratioY = 0.5 , |
||
bool | simulateMove = True , |
||
float | waitTime = OPERATION_WAIT_TIME |
||
) |
x: int, if < 0, middle click self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, middle click self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool, if True, first move cursor to control smoothly. waitTime: float. MiddleClick(), MiddleClick(ratioX=0.5, ratioY=0.5): middle click center. MiddleClick(10, 10): middle click left+10, top+10. MiddleClick(-10, -10): middle click right-10, bottom-10.
Tuple[int, int] uiautomation.uiautomation.Control.MoveCursorToInnerPos | ( | self, | |
int | x = None , |
||
int | y = None , |
||
float | ratioX = 0.5 , |
||
float | ratioY = 0.5 , |
||
bool | simulateMove = True |
||
) |
Move cursor to control's internal position, default to center. x: int, if < 0, move to self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, move to self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool. Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0) after moving or None if control's width or height is 0.
Tuple[int, int] uiautomation.uiautomation.Control.MoveCursorToMyCenter | ( | self, | |
bool | simulateMove = True |
||
) |
Move cursor to control's center. Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0) after moving.
bool uiautomation.uiautomation.Control.MoveWindow | ( | self, | |
int | x, | ||
int | y, | ||
int | width, | ||
int | height, | ||
bool | repaint = True |
||
) |
Call native MoveWindow if control has a valid native handle. x: int. y: int. width: int. height: int. repaint: bool. Return bool, True if succeed otherwise False.
str uiautomation.uiautomation.Control.Name | ( | self | ) |
Property Name. Call IUIAutomationElement::get_CurrentName. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
str uiautomation.uiautomation.Control.NativeWindowHandle | ( | self | ) |
Property NativeWindowHandle. Call IUIAutomationElement::get_CurrentNativeWindowHandle. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
int uiautomation.uiautomation.Control.Orientation | ( | self | ) |
Property Orientation. Return int, a value in class `OrientationType`. Call IUIAutomationElement::get_CurrentOrientation. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
'PaneControl' uiautomation.uiautomation.Control.PaneControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
int uiautomation.uiautomation.Control.ProcessId | ( | self | ) |
Property ProcessId. Call IUIAutomationElement::get_CurrentProcessId. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
'ProgressBarControl' uiautomation.uiautomation.Control.ProgressBarControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
str uiautomation.uiautomation.Control.ProviderDescription | ( | self | ) |
Property ProviderDescription. Call IUIAutomationElement::get_CurrentProviderDescription. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
'RadioButtonControl' uiautomation.uiautomation.Control.RadioButtonControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
bool uiautomation.uiautomation.Control.Refind | ( | self, | |
float | maxSearchSeconds = TIME_OUT_SECOND , |
||
float | searchIntervalSeconds = SEARCH_INTERVAL , |
||
bool | raiseException = True |
||
) |
Refind the control every searchIntervalSeconds seconds in maxSearchSeconds seconds. maxSearchSeconds: float. searchIntervalSeconds: float. raiseException: bool, if True, raise a LookupError if timeout. Return bool, True if find.
None uiautomation.uiautomation.Control.RemoveSearchProperties | ( | self, | |
** | searchProperties | ||
) |
searchProperties: dict, same as searchProperties in `Control.__init__`.
None uiautomation.uiautomation.Control.RightClick | ( | self, | |
int | x = None , |
||
int | y = None , |
||
float | ratioX = 0.5 , |
||
float | ratioY = 0.5 , |
||
bool | simulateMove = True , |
||
float | waitTime = OPERATION_WAIT_TIME |
||
) |
x: int, if < 0, right click self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, right click self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. simulateMove: bool, if True, first move cursor to control smoothly. waitTime: float. RightClick(), RightClick(ratioX=0.5, ratioY=0.5): right click center. RightClick(10, 10): right click left+10, top+10. RightClick(-10, -10): right click right-10, bottom-10.
'ScrollBarControl' uiautomation.uiautomation.Control.ScrollBarControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'SemanticZoomControl' uiautomation.uiautomation.Control.SemanticZoomControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
None uiautomation.uiautomation.Control.SendKey | ( | self, | |
int | key, | ||
float | waitTime = OPERATION_WAIT_TIME |
||
) |
Make control have focus first and type a key. `self.SetFocus` may not work for some controls, you may need to click it to make it have focus. key: int, a key code value in class Keys. waitTime: float.
None uiautomation.uiautomation.Control.SendKeys | ( | self, | |
str | text, | ||
float | interval = 0.01 , |
||
float | waitTime = OPERATION_WAIT_TIME , |
||
bool | charMode = True |
||
) |
Make control have focus first and type keys. `self.SetFocus` may not work for some controls, you may need to click it to make it have focus. text: str, keys to type, see the docstring of `SendKeys`. interval: float, seconds between keys. waitTime: float. charMode: bool, if False, the text typied is depend on the input method if a input method is on.
'SeparatorControl' uiautomation.uiautomation.Control.SeparatorControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
bool uiautomation.uiautomation.Control.SetFocus | ( | self | ) |
Call IUIAutomationElement::SetFocus. Refer https://docs.microsoft.com/en-us/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
None uiautomation.uiautomation.Control.SetSearchDepth | ( | self, | |
int | searchDepth | ||
) |
None uiautomation.uiautomation.Control.SetSearchFromControl | ( | self, | |
'Control' | searchFromControl | ||
) |
searchFromControl: `Control` or its subclass
bool uiautomation.uiautomation.Control.SetWindowText | ( | self, | |
str | text | ||
) |
Call native SetWindowText if control has a valid native handle.
bool uiautomation.uiautomation.Control.Show | ( | self, | |
float | waitTime = OPERATION_WAIT_TIME |
||
) |
Call native `ShowWindow(SW.Show)`. Return bool, True if succeed otherwise False.
bool uiautomation.uiautomation.Control.ShowWindow | ( | self, | |
int | cmdShow, | ||
float | waitTime = OPERATION_WAIT_TIME |
||
) |
Get a native handle from self or ancestors until valid and call native `ShowWindow` with cmdShow. cmdShow: int, a value in in class `SW`. waitTime: float. Return bool, True if succeed otherwise False.
'SliderControl' uiautomation.uiautomation.Control.SliderControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'SpinnerControl' uiautomation.uiautomation.Control.SpinnerControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'SplitButtonControl' uiautomation.uiautomation.Control.SplitButtonControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'StatusBarControl' uiautomation.uiautomation.Control.StatusBarControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'TabControl' uiautomation.uiautomation.Control.TabControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'TabItemControl' uiautomation.uiautomation.Control.TabItemControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'TableControl' uiautomation.uiautomation.Control.TableControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'TextControl' uiautomation.uiautomation.Control.TextControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'ThumbControl' uiautomation.uiautomation.Control.ThumbControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'TitleBarControl' uiautomation.uiautomation.Control.TitleBarControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
Bitmap uiautomation.uiautomation.Control.ToBitmap | ( | self, | |
int | x = 0 , |
||
int | y = 0 , |
||
int | width = 0 , |
||
int | height = 0 |
||
) |
Capture control to a Bitmap object. x, y: int, the point in control's internal position(from 0,0). width, height: int, image's width and height from x, y, use 0 for entire area. If width(or height) < 0, image size will be control's width(or height) - width(or height).
'ToolBarControl' uiautomation.uiautomation.Control.ToolBarControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'ToolTipControl' uiautomation.uiautomation.Control.ToolTipControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'TreeControl' uiautomation.uiautomation.Control.TreeControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
'TreeItemControl' uiautomation.uiautomation.Control.TreeItemControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
None uiautomation.uiautomation.Control.WheelDown | ( | self, | |
int | x = None , |
||
int | y = None , |
||
float | ratioX = 0.5 , |
||
float | ratioY = 0.5 , |
||
int | wheelTimes = 1 , |
||
float | interval = 0.05 , |
||
float | waitTime = OPERATION_WAIT_TIME |
||
) |
Make control have focus first, move cursor to the specified position and mouse wheel down. x: int, if < 0, move x cursor to self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, move y cursor to self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. wheelTimes: int. interval: float. waitTime: float.
None uiautomation.uiautomation.Control.WheelUp | ( | self, | |
int | x = None , |
||
int | y = None , |
||
float | ratioX = 0.5 , |
||
float | ratioY = 0.5 , |
||
int | wheelTimes = 1 , |
||
float | interval = 0.05 , |
||
float | waitTime = OPERATION_WAIT_TIME |
||
) |
Make control have focus first, move cursor to the specified position and mouse wheel up. x: int, if < 0, move x cursor to self.BoundingRectangle.right + x, if not None, ignore ratioX. y: int, if < 0, move y cursor to self.BoundingRectangle.bottom + y, if not None, ignore ratioY. ratioX: float. ratioY: float. wheelTimes: int. interval: float. waitTime: float.
'WindowControl' uiautomation.uiautomation.Control.WindowControl | ( | self, | |
searchDepth = 0xFFFFFFFF , |
|||
searchInterval = SEARCH_INTERVAL , |
|||
foundIndex = 1 , |
|||
element = 0 , |
|||
** | searchProperties | ||
) |
uiautomation.uiautomation.Control.foundIndex |
uiautomation.uiautomation.Control.regexName |
uiautomation.uiautomation.Control.searchDepth |
uiautomation.uiautomation.Control.searchFromControl |
uiautomation.uiautomation.Control.searchInterval |
uiautomation.uiautomation.Control.searchProperties |
|
static |