| |
- _ctypes.Structure(_ctypes._CData)
-
- ConsoleScreenBufferInfo
- HARDWAREINPUT
- INPUT
- KEYBDINPUT
- MOUSEINPUT
- tagPROCESSENTRY32
- builtins.object
-
- AccessibleRole
- AccessibleSelection
- AccessibleState
- AnnotationPattern
- AnnotationType
- Bitmap
- ClipboardFormat
- ConsoleColor
- Control
-
- AppBarControl
- ButtonControl
- CalendarControl
- CheckBoxControl
- ComboBoxControl
- CustomControl
- DataGridControl
- DataItemControl
- DocumentControl
- EditControl
- GroupControl
- HeaderControl
- HeaderItemControl
- HyperlinkControl
- ImageControl
- ListControl
- ListItemControl
- MenuBarControl
- MenuControl
- MenuItemControl
- PaneControl(Control, TopLevel)
- ProgressBarControl
- RadioButtonControl
- ScrollBarControl
- SemanticZoomControl
- SeparatorControl
- SliderControl
- SpinnerControl
- SplitButtonControl
- StatusBarControl
- TabControl
- TabItemControl
- TableControl
- TextControl
- ThumbControl
- TitleBarControl
- ToolBarControl
- ToolTipControl
- TreeControl
- TreeItemControl
- WindowControl(Control, TopLevel)
- ControlType
- CustomNavigationPattern
- DockPattern
- DockPosition
- DpiAwarenessContext
- DragPattern
- DropTargetPattern
- ExpandCollapsePattern
- ExpandCollapseState
- GAFlag
- GWL
- GridItemPattern
- GridPattern
- InputType
- InvokePattern
- ItemContainerPattern
- KeyboardEventFlag
- Keys
- LegacyIAccessiblePattern
- Logger
- MB
- ModifierKey
- MouseEventFlag
- MultipleViewPattern
- NavigateDirection
- ObjectModelPattern
- OrientationType
- PatternId
- ProcessDpiAwareness
- ProcessInfo
- PropertyId
- RangeValuePattern
- Rect
- RotateFlipType
- RowOrColumnMajor
- SW
- SWP
- ScrollAmount
- ScrollItemPattern
- ScrollPattern
- SelectionItemPattern
- SelectionPattern
- SpreadsheetItemPattern
- SpreadsheetPattern
- StyleId
- StylesPattern
- SynchronizedInputPattern
- TableItemPattern
- TablePattern
- TextAttributeId
- TextChildPattern
- TextEditPattern
- TextPattern
- TextPattern2
- TextPatternRangeEndpoint
- TextRange
- TextUnit
- TogglePattern
- ToggleState
- TopLevel
- TransformPattern
- TransformPattern2
- UIAutomationInitializerInThread
- ValuePattern
- VirtualizedItemPattern
- WindowInteractionState
- WindowPattern
- WindowVisualState
- ZoomUnit
class AccessibleRole(builtins.object) |
|
AccessibleRole from IUIAutomation.
Refer https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.accessiblerole?view=netframework-4.8 |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- Alert = 8
- Animation = 54
- Application = 14
- Border = 19
- ButtonDropDown = 56
- ButtonDropDownGrid = 58
- ButtonMenu = 57
- Caret = 7
- Cell = 29
- Character = 32
- Chart = 17
- CheckButton = 44
- Client = 10
- Clock = 61
- Column = 27
- ColumnHeader = 25
- ComboBox = 46
- Cursor = 6
- Diagram = 53
- Dial = 49
- Dialog = 18
- Document = 15
- DropList = 47
- Equation = 55
- Graphic = 40
- Grip = 4
- Grouping = 20
- HelpBalloon = 31
- HotkeyField = 50
- Indicator = 39
- IpAddress = 63
- Link = 30
- List = 33
- ListItem = 34
- MenuBar = 2
- MenuItem = 12
- MenuPopup = 11
- Outline = 35
- OutlineButton = 64
- OutlineItem = 36
- PageTab = 37
- PageTabList = 60
- Pane = 16
- ProgressBar = 48
- PropertyPage = 38
- PushButton = 43
- RadioButton = 45
- Row = 28
- RowHeader = 26
- ScrollBar = 3
- Separator = 21
- Slider = 51
- Sound = 5
- SpinButton = 52
- SplitButton = 62
- StaticText = 41
- StatusBar = 23
- Table = 24
- Text = 42
- TitleBar = 1
- ToolTip = 13
- Toolbar = 22
- WhiteSpace = 59
- Window = 9
|
class AccessibleState(builtins.object) |
|
AccessibleState from IUIAutomation.
Refer https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.accessiblestates?view=netframework-4.8 |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- AlertHigh = 268435456
- AlertLow = 67108864
- AlertMedium = 134217728
- Animated = 16384
- Busy = 2048
- Checked = 16
- Collapsed = 1024
- Default = 256
- Expanded = 512
- ExtSelectable = 33554432
- Floating = 4096
- Focusable = 1048576
- Focused = 4
- HasPopup = 1073741824
- HotTracked = 128
- Indeterminate = 32
- Invisible = 32768
- Linked = 4194304
- Marqueed = 8192
- Mixed = 32
- Moveable = 262144
- MultiSelectable = 16777216
- Normal = 0
- Offscreen = 65536
- Pressed = 8
- Protected = 536870912
- ReadOnly = 64
- Selectable = 2097152
- Selected = 2
- SelfVoicing = 524288
- Sizeable = 131072
- Traversed = 8388608
- Unavailable = 1
- Valid = 2147483647
|
class AnnotationType(builtins.object) |
|
AnnotationType from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-annotation-type-identifiers |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- AdvancedProofingIssue = 60020
- Author = 60019
- CircularReferenceError = 60022
- Comment = 60003
- ConflictingChange = 60018
- DataValidationError = 60021
- DeletionChange = 60012
- EditingLockedChange = 60016
- Endnote = 60009
- ExternalChange = 60017
- Footer = 60007
- Footnote = 60010
- FormatChange = 60014
- FormulaError = 60004
- GrammarError = 60002
- Header = 60006
- Highlighted = 60008
- InsertionChange = 60011
- Mathematics = 60023
- MoveChange = 60013
- SpellingError = 60001
- TrackChanges = 60005
- Unknown = 60000
- UnsyncedChange = 60015
|
class AppBarControl(Control) |
|
AppBarControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- AppBarControl
- Control
- builtins.object
Methods defined here:
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class Bitmap(builtins.object) |
|
Bitmap(width: int = 0, height: int = 0)
A simple Bitmap class wraps Windows GDI+ Gdiplus::Bitmap, but may not have high efficiency.
The color format is ARGB. |
|
Methods defined here:
- Clear(self, color: int = 4294967295, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- Set the color of rect(x,y,width,height).
color: int, ARGB color format.
x: int.
y: int.
width: int, if == 0, the width will be self.Width-x
height: int, if == 0, the height will be self.Height-y
Return bool.
- Close(self) -> None
- Close the underlying Gdiplus::Bitmap object.
- Copy(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> 'Bitmap'
- x: int, must >= 0.
y: int, must >= 0.
width: int, must <= self.Width-x.
height: int, must <= self.Height-y.
Return `Bitmap`, a new Bitmap copied from (x,y,width,height).
- GetAllPixelColors(self) -> _ctypes.Array
- Return `ctypes.Array`, an iterable array of int values in ARGB color format.
- GetPixelColor(self, x: int, y: int) -> int
- Get color value of a pixel.
x: int.
y: int.
Return int, ARGB color format.
b = argb & 0x0000FF
g = (argb & 0x00FF00) >> 8
r = (argb & 0xFF0000) >> 16
a = (argb & 0xFF0000) >> 24
- GetPixelColorsHorizontally(self, x: int, y: int, count: int) -> _ctypes.Array
- x: int.
y: int.
count: int.
Return `ctypes.Array`, an iterable array of int values in ARGB color format form point x,y horizontally.
- GetPixelColorsOfColumn(self, x: int) -> _ctypes.Array
- x: int, column index.
Return `ctypes.Array`, an iterable array of int values in ARGB color format of x column.
- GetPixelColorsOfRect(self, x: int, y: int, width: int, height: int) -> _ctypes.Array
- x: int.
y: int.
width: int.
height: int.
Return `ctypes.Array`, an iterable array of int values in ARGB color format of the input rect.
- GetPixelColorsOfRects(self, rects: List[Tuple[int, int, int, int]]) -> List[_ctypes.Array]
- rects: List[Tuple[int, int, int, int]], such as [(0,0,10,10), (10,10,20,20), (x,y,width,height)].
Return List[ctypes.Array], a list whose elements are ctypes.Array which is an iterable array of int values in ARGB color format.
- GetPixelColorsOfRow(self, y: int) -> _ctypes.Array
- y: int, row index.
Return `ctypes.Array`, an iterable array of int values in ARGB color format of y row.
- GetPixelColorsVertically(self, x: int, y: int, count: int) -> _ctypes.Array
- x: int.
y: int.
count: int.
Return `ctypes.Array`, an iterable array of int values in ARGB color format form point x,y vertically.
- Paste(self, x: int, y: int, bitmap: 'Bitmap') -> bool
- Paste bitmap to (x,y) of self, modify the original Bitmap,
if x < 0 or x+bitmap.Width > self.Width, only the intersection part of bitmap is pasted,
if y < 0 or y+bitmap.Height > self.Height, only the intersection part of bitmap is pasted.
x: int, can < 0.
y: int, can < 0.
bitmap: `Bitmap`.
Return bool, True if bitmap or a part of bitmap is pasted.
- PastePart(self, dstX: int, dstY: int, srcBitmap: 'Bitmap', srcX: int = 0, srcY: int = 0, srcWidth: int = 0, srcHeight: int = 0) -> bool
- Paste (srcX, srcY, srcWidth, srcHeight) of bitmap to (dstX, dstY) of self, modify the original Bitmap,
only the intersection part of the bitmap is pasted.
dstX: int, must >= 0.
dstY: int, must >= 0.
srcBitmap: `Bitmap`.
srcX: int, must >= 0.
srcY: int, must >= 0.
srcWidth: int, must >= 0 and <= srcBitmap.Width - srcX.
srcHeight: int, must >= 0 and <= srcBitmap.Height - srcY.
Return bool, True if a part of srcBitmap is pasted.
- Release = Close(self) -> None
- Resize(self, width: int, height: int) -> 'Bitmap'
- Resize a copy of the original to size (width, height), the original Bitmap is not modified.
width: int.
height: int.
Return a new `Bitmap`, the original is not modified.
- Rotate(self, angle: int, backgroundColor: int = 4294967295) -> 'Bitmap'
- Rotate a copy of the original with angle, the original Bitmap is not modified.
angle: int.
backgroundColor: int, ARGB color format.
Return a new `Bitmap`, the original is not modified.
- RotateFlip(self, rotateFlip: int) -> 'Bitmap'
- Rotate 90*n or Filp a copy of the original, the original Bitmap is not modified.
rotateFlip: int, a value in class `RotateFlipType`.
Return a new `Bitmap`, the original is not modified.
- SetAllPixelColors(self, colors: Sequence[int]) -> bool
- colors: Sequence[int], a sequence of int values in ARGB color format, it's length must equal to width*height,
use ctypes.Array for better performance, such as `ctypes.c_uint32 * (width*height)`.
Return bool.
- SetPixelColor(self, x: int, y: int, argb: int) -> bool
- Set color value of a pixel.
x: int.
y: int.
argb: int, ARGB color format.
Return bool, True if succeed otherwise False.
- SetPixelColorsHorizontally(self, x: int, y: int, colors: Sequence[int]) -> bool
- Set pixel colors form x,y horizontally.
x: int.
y: int.
colors: Sequence[int], an iterable list of int color values in ARGB color format,
use ctypes.Array for better performance, such as `ctypes.c_uint32 * length`.
Return bool, True if succeed otherwise False.
- SetPixelColorsOfRect(self, x: int, y: int, width: int, height: int, colors: Sequence[int]) -> bool
- x: int.
y: int.
width: int.
height: int.
colors: Sequence[int], a sequence of int values in ARGB color format, it's length must equal to width*height,
use ctypes.Array for better performance, such as `ctypes.c_uint32 * (width*height)`.
Return bool.
- SetPixelColorsVertically(self, x: int, y: int, colors: Sequence[int]) -> bool
- Set pixel colors form x,y vertically.
x: int.
y: int.
colors: Sequence[int], an iterable list of int color values in ARGB color format,
use ctypes.Array for better performance, such as `ctypes.c_uint32 * length`.
Return bool, True if succeed otherwise False.
- ToFile(self, savePath: str) -> bool
- Save to a file.
savePath: str, should end with .bmp, .jpg, .jpeg, .png, .gif, .tif, .tiff.
Return bool, True if succeed otherwise False.
- __bool__(self)
- __del__(self)
- __enter__(self)
- __exit__(self, exceptionType, exceptionValue, exceptionTraceback)
- __init__(self, width: int = 0, height: int = 0)
- Create a black transparent(ARGB=0x00000000) bimap of size(width, height).
- __repr__(self) -> str
- Return repr(self).
- __str__(self) -> str
- Return str(self).
Static methods defined here:
- FromControl(control: 'Control', x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[ForwardRef('Bitmap')]
- Create a `Bitmap` from a `Control`.
control: `Control` or its subclass.
x: int.
y: int.
width: int.
height: int.
x, y: the point in control's internal position(from 0,0)
width, height: 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 `Bitmap` or None.
- FromFile(filePath: str) -> Optional[ForwardRef('Bitmap')]
- Create a `Bitmap` from a file path.
filePath: str.
Return `Bitmap` or None.
- FromHandle(hwnd: int, left: int = 0, top: int = 0, right: int = 0, bottom: int = 0) -> Optional[ForwardRef('Bitmap')]
- Create a `Bitmap` from a native window handle.
hwnd: int, the handle of a native window.
left: int.
top: int.
right: int.
bottom: int.
left, top, right and bottom are control's internal postion(from 0,0).
Return `Bitmap` or None.
Readonly properties defined here:
- Height
- Property Height.
Return int.
- Width
- Property Width.
Return int.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class ButtonControl(Control) |
|
ButtonControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- ButtonControl
- Control
- builtins.object
Methods defined here:
- GetExpandCollapsePattern(self) -> uiautomation.ExpandCollapsePattern
- Return `ExpandCollapsePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetInvokePattern(self) -> uiautomation.InvokePattern
- Return `InvokePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTogglePattern(self) -> uiautomation.TogglePattern
- Return `TogglePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class CalendarControl(Control) |
|
CalendarControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- CalendarControl
- Control
- builtins.object
Methods defined here:
- GetGridPattern(self) -> uiautomation.GridPattern
- Return `GridPattern` if it supports the pattern else None(Must support according to MSDN).
- GetScrollPattern(self) -> uiautomation.ScrollPattern
- Return `ScrollPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionPattern(self) -> uiautomation.SelectionPattern
- Return `SelectionPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTablePattern(self) -> uiautomation.TablePattern
- Return `TablePattern` if it supports the pattern else None(Must support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class CheckBoxControl(Control) |
|
CheckBoxControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- CheckBoxControl
- Control
- builtins.object
Methods defined here:
- GetTogglePattern(self) -> uiautomation.TogglePattern
- Return `TogglePattern` if it supports the pattern else None(Must support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class ClipboardFormat(builtins.object) |
| |
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- CF_BITMAP = 2
- CF_DIB = 8
- CF_DIBV5 = 17
- CF_DIF = 5
- CF_ENHMETAFILE = 14
- CF_HDROP = 15
- CF_HTML = 49343
- CF_LOCALE = 16
- CF_MAX = 18
- CF_METAFILEPICT = 3
- CF_OEMTEXT = 7
- CF_PALETTE = 9
- CF_PENDATA = 10
- CF_RIFF = 11
- CF_SYLK = 4
- CF_TEXT = 1
- CF_TIFF = 6
- CF_UNICODETEXT = 13
- CF_WAVE = 12
|
class ComboBoxControl(Control) |
|
ComboBoxControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- ComboBoxControl
- Control
- builtins.object
Methods defined here:
- GetExpandCollapsePattern(self) -> uiautomation.ExpandCollapsePattern
- Return `ExpandCollapsePattern` if it supports the pattern else None(Must support according to MSDN).
- GetSelectionPattern(self) -> uiautomation.SelectionPattern
- Return `SelectionPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetValuePattern(self) -> uiautomation.ValuePattern
- Return `ValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- Select(self, itemName: str = '', condition: Optional[Callable[[str], bool]] = None, simulateMove: bool = True, waitTime: float = 0.5) -> bool
- Show combobox's popup menu and select a item by name.
itemName: str.
condition: Callable[[str], bool], function(comboBoxItemName: str) -> bool, if condition is valid, ignore itemName.
waitTime: float.
Some comboboxs doesn't support SelectionPattern, here is a workaround.
This method tries to add selection support.
It may not work for some comboboxes, such as comboboxes in older Qt version.
If it doesn't work, you should write your own version Select, or it doesn't support selection at all.
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class ConsoleColor(builtins.object) |
|
ConsoleColor from Win32. |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- Black = 0
- Blue = 9
- Cyan = 11
- DarkBlue = 1
- DarkCyan = 3
- DarkGray = 8
- DarkGreen = 2
- DarkMagenta = 5
- DarkRed = 4
- DarkYellow = 6
- Default = -1
- Gray = 7
- Green = 10
- Magenta = 13
- Red = 12
- White = 15
- Yellow = 14
|
class Control(builtins.object) |
|
Control(searchFromControl: Optional[ForwardRef('Control')] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
Methods defined here:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __init__(self, searchFromControl: Optional[ForwardRef('Control')] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
- __str__(self) -> str
- Return str(self).
Static methods defined here:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties defined here:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class ControlType(builtins.object) |
|
ControlType from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-controltype-ids |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- AppBarControl = 50040
- ButtonControl = 50000
- CalendarControl = 50001
- CheckBoxControl = 50002
- ComboBoxControl = 50003
- CustomControl = 50025
- DataGridControl = 50028
- DataItemControl = 50029
- DocumentControl = 50030
- EditControl = 50004
- GroupControl = 50026
- HeaderControl = 50034
- HeaderItemControl = 50035
- HyperlinkControl = 50005
- ImageControl = 50006
- ListControl = 50008
- ListItemControl = 50007
- MenuBarControl = 50010
- MenuControl = 50009
- MenuItemControl = 50011
- PaneControl = 50033
- ProgressBarControl = 50012
- RadioButtonControl = 50013
- ScrollBarControl = 50014
- SemanticZoomControl = 50039
- SeparatorControl = 50038
- SliderControl = 50015
- SpinnerControl = 50016
- SplitButtonControl = 50031
- StatusBarControl = 50017
- TabControl = 50018
- TabItemControl = 50019
- TableControl = 50036
- TextControl = 50020
- ThumbControl = 50027
- TitleBarControl = 50037
- ToolBarControl = 50021
- ToolTipControl = 50022
- TreeControl = 50023
- TreeItemControl = 50024
- WindowControl = 50032
|
class CustomControl(Control) |
|
CustomControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- CustomControl
- Control
- builtins.object
Methods defined here:
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class DataGridControl(Control) |
|
DataGridControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- DataGridControl
- Control
- builtins.object
Methods defined here:
- GetGridPattern(self) -> uiautomation.GridPattern
- Return `GridPattern` if it supports the pattern else None(Must support according to MSDN).
- GetScrollPattern(self) -> uiautomation.ScrollPattern
- Return `ScrollPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionPattern(self) -> uiautomation.SelectionPattern
- Return `SelectionPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTablePattern(self) -> uiautomation.TablePattern
- Return `TablePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class DataItemControl(Control) |
|
DataItemControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- DataItemControl
- Control
- builtins.object
Methods defined here:
- GetExpandCollapsePattern(self) -> uiautomation.ExpandCollapsePattern
- Return `ExpandCollapsePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetGridItemPattern(self) -> uiautomation.GridItemPattern
- Return `GridItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetScrollItemPattern(self) -> uiautomation.ScrollItemPattern
- Return `ScrollItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionItemPattern(self) -> uiautomation.SelectionItemPattern
- Return `SelectionItemPattern` if it supports the pattern else None(Must support according to MSDN).
- GetTableItemPattern(self) -> uiautomation.TableItemPattern
- Return `TableItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTogglePattern(self) -> uiautomation.TogglePattern
- Return `TogglePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetValuePattern(self) -> uiautomation.ValuePattern
- Return `ValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class DocumentControl(Control) |
|
DocumentControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- DocumentControl
- Control
- builtins.object
Methods defined here:
- GetScrollPattern(self) -> uiautomation.ScrollPattern
- Return `ScrollPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTextPattern(self) -> uiautomation.TextPattern
- Return `TextPattern` if it supports the pattern else None(Must support according to MSDN).
- GetValuePattern(self) -> uiautomation.ValuePattern
- Return `ValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class DpiAwarenessContext(builtins.object) |
| |
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- PerMonitorAware = -3
- PerMonitorAwareV2 = -4
- SystemAware = -2
- Unaware = -1
- UnawareGdiScaled = -5
|
class EditControl(Control) |
|
EditControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- EditControl
- Control
- builtins.object
Methods defined here:
- GetRangeValuePattern(self) -> uiautomation.RangeValuePattern
- Return `RangeValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTextPattern(self) -> uiautomation.TextPattern
- Return `TextPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetValuePattern(self) -> uiautomation.ValuePattern
- Return `ValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class GAFlag(builtins.object) |
|
GAFlag from Win32. |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- Parent = 1
- Root = 2
- RootOwner = 3
|
class GWL(builtins.object) |
| |
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- ExStyle = -20
- HInstance = -6
- HwndParent = -8
- ID = -12
- Style = -16
- UserData = -21
- WndProc = -4
|
class GroupControl(Control) |
|
GroupControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- GroupControl
- Control
- builtins.object
Methods defined here:
- GetExpandCollapsePattern(self) -> uiautomation.ExpandCollapsePattern
- Return `ExpandCollapsePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class HeaderControl(Control) |
|
HeaderControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- HeaderControl
- Control
- builtins.object
Methods defined here:
- GetTransformPattern(self) -> uiautomation.TransformPattern
- Return `TransformPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class HeaderItemControl(Control) |
|
HeaderItemControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- HeaderItemControl
- Control
- builtins.object
Methods defined here:
- GetInvokePattern(self) -> uiautomation.InvokePattern
- Return `InvokePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTransformPattern(self) -> uiautomation.TransformPattern
- Return `TransformPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class HyperlinkControl(Control) |
|
HyperlinkControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- HyperlinkControl
- Control
- builtins.object
Methods defined here:
- GetInvokePattern(self) -> uiautomation.InvokePattern
- Return `InvokePattern` if it supports the pattern else None(Must support according to MSDN).
- GetValuePattern(self) -> uiautomation.ValuePattern
- Return `ValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class ImageControl(Control) |
|
ImageControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- ImageControl
- Control
- builtins.object
Methods defined here:
- GetGridItemPattern(self) -> uiautomation.GridItemPattern
- Return `GridItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTableItemPattern(self) -> uiautomation.TableItemPattern
- Return `TableItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class InputType(builtins.object) |
|
InputType from Win32 |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- Hardware = 2
- Keyboard = 1
- Mouse = 0
|
class KeyboardEventFlag(builtins.object) |
|
KeyboardEventFlag from Win32. |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- ExtendedKey = 1
- KeyDown = 0
- KeyScanCode = 8
- KeyUnicode = 4
- KeyUp = 2
|
class Keys(builtins.object) |
|
Key codes from Win32. |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- VK_0 = 48
- VK_1 = 49
- VK_2 = 50
- VK_3 = 51
- VK_4 = 52
- VK_5 = 53
- VK_6 = 54
- VK_7 = 55
- VK_8 = 56
- VK_9 = 57
- VK_A = 65
- VK_ACCEPT = 30
- VK_ADD = 107
- VK_APPS = 93
- VK_ATTN = 246
- VK_B = 66
- VK_BACK = 8
- VK_BROWSER_BACK = 166
- VK_BROWSER_FAVORITES = 171
- VK_BROWSER_FORWARD = 167
- VK_BROWSER_HOME = 172
- VK_BROWSER_REFRESH = 168
- VK_BROWSER_SEARCH = 170
- VK_BROWSER_STOP = 169
- VK_C = 67
- VK_CANCEL = 3
- VK_CAPITAL = 20
- VK_CLEAR = 12
- VK_CONTROL = 17
- VK_CONVERT = 28
- VK_CRSEL = 247
- VK_D = 68
- VK_DECIMAL = 110
- VK_DELETE = 46
- VK_DIVIDE = 111
- VK_DOWN = 40
- VK_E = 69
- VK_END = 35
- VK_ENTER = 13
- VK_EREOF = 249
- VK_ESCAPE = 27
- VK_EXECUTE = 43
- VK_EXSEL = 248
- VK_F = 70
- VK_F1 = 112
- VK_F10 = 121
- VK_F11 = 122
- VK_F12 = 123
- VK_F13 = 124
- VK_F14 = 125
- VK_F15 = 126
- VK_F16 = 127
- VK_F17 = 128
- VK_F18 = 129
- VK_F19 = 130
- VK_F2 = 113
- VK_F20 = 131
- VK_F21 = 132
- VK_F22 = 133
- VK_F23 = 134
- VK_F24 = 135
- VK_F3 = 114
- VK_F4 = 115
- VK_F5 = 116
- VK_F6 = 117
- VK_F7 = 118
- VK_F8 = 119
- VK_F9 = 120
- VK_FINAL = 24
- VK_G = 71
- VK_H = 72
- VK_HANGUEL = 21
- VK_HANGUL = 21
- VK_HANJA = 25
- VK_HELP = 47
- VK_HOME = 36
- VK_I = 73
- VK_INSERT = 45
- VK_J = 74
- VK_JUNJA = 23
- VK_K = 75
- VK_KANA = 21
- VK_KANJI = 25
- VK_L = 76
- VK_LAUNCH_APP1 = 182
- VK_LAUNCH_APP2 = 183
- VK_LAUNCH_MAIL = 180
- VK_LAUNCH_MEDIA_SELECT = 181
- VK_LBUTTON = 1
- VK_LCONTROL = 162
- VK_LEFT = 37
- VK_LMENU = 164
- VK_LSHIFT = 160
- VK_LWIN = 91
- VK_M = 77
- VK_MBUTTON = 4
- VK_MEDIA_NEXT_TRACK = 176
- VK_MEDIA_PLAY_PAUSE = 179
- VK_MEDIA_PREV_TRACK = 177
- VK_MEDIA_STOP = 178
- VK_MENU = 18
- VK_MODECHANGE = 31
- VK_MULTIPLY = 106
- VK_N = 78
- VK_NEXT = 34
- VK_NONAME = 252
- VK_NONCONVERT = 29
- VK_NUMLOCK = 144
- VK_NUMPAD0 = 96
- VK_NUMPAD1 = 97
- VK_NUMPAD2 = 98
- VK_NUMPAD3 = 99
- VK_NUMPAD4 = 100
- VK_NUMPAD5 = 101
- VK_NUMPAD6 = 102
- VK_NUMPAD7 = 103
- VK_NUMPAD8 = 104
- VK_NUMPAD9 = 105
- VK_O = 79
- VK_OEM_1 = 186
- VK_OEM_102 = 226
- VK_OEM_2 = 191
- VK_OEM_3 = 192
- VK_OEM_4 = 219
- VK_OEM_5 = 220
- VK_OEM_6 = 221
- VK_OEM_7 = 222
- VK_OEM_8 = 223
- VK_OEM_CLEAR = 254
- VK_OEM_COMMA = 188
- VK_OEM_MINUS = 189
- VK_OEM_PERIOD = 190
- VK_OEM_PLUS = 187
- VK_P = 80
- VK_PA1 = 253
- VK_PACKET = 231
- VK_PAGEDOWN = 34
- VK_PAGEUP = 33
- VK_PAUSE = 19
- VK_PLAY = 250
- VK_PRINT = 42
- VK_PRIOR = 33
- VK_PROCESSKEY = 229
- VK_Q = 81
- VK_R = 82
- VK_RBUTTON = 2
- VK_RCONTROL = 163
- VK_RETURN = 13
- VK_RIGHT = 39
- VK_RMENU = 165
- VK_RSHIFT = 161
- VK_RWIN = 92
- VK_S = 83
- VK_SCROLL = 145
- VK_SELECT = 41
- VK_SEPARATOR = 108
- VK_SHIFT = 16
- VK_SLEEP = 95
- VK_SNAPSHOT = 44
- VK_SPACE = 32
- VK_SUBTRACT = 109
- VK_T = 84
- VK_TAB = 9
- VK_U = 85
- VK_UP = 38
- VK_V = 86
- VK_VOLUME_DOWN = 174
- VK_VOLUME_MUTE = 173
- VK_VOLUME_UP = 175
- VK_W = 87
- VK_X = 88
- VK_XBUTTON1 = 5
- VK_XBUTTON2 = 6
- VK_Y = 89
- VK_Z = 90
- VK_ZOOM = 251
|
class LegacyIAccessiblePattern(builtins.object) |
|
LegacyIAccessiblePattern(pattern=None)
|
|
Methods defined here:
- DoDefaultAction(self, waitTime: float = 0.5) -> bool
- Call IUIAutomationLegacyIAccessiblePattern::DoDefaultAction.
Perform the Microsoft Active Accessibility default action for the element.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-dodefaultaction
- GetIAccessible(self)
- Call IUIAutomationLegacyIAccessiblePattern::GetIAccessible, todo.
Return an IAccessible object that corresponds to the Microsoft UI Automation element.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-getiaccessible
Refer https://docs.microsoft.com/en-us/windows/win32/api/oleacc/nn-oleacc-iaccessible
- GetSelection(self) -> List[ForwardRef('Control')]
- Call IUIAutomationLegacyIAccessiblePattern::GetCurrentSelection.
Return List[Control], a list of `Control` subclasses,
the Microsoft Active Accessibility property that identifies the selected children of this element.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-getcurrentselection
- Select(self, flagsSelect: int, waitTime: float = 0.5) -> bool
- Call IUIAutomationLegacyIAccessiblePattern::Select.
Perform a Microsoft Active Accessibility selection.
flagsSelect: int, a value in `AccessibleSelection`.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-select
- SetValue(self, value: str, waitTime: float = 0.5) -> bool
- Call IUIAutomationLegacyIAccessiblePattern::SetValue.
Set the Microsoft Active Accessibility value property for the element.
value: str.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-setvalue
- __init__(self, pattern=None)
- Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationlegacyiaccessiblepattern
Readonly properties defined here:
- ChildId
- Property ChildId.
Call IUIAutomationLegacyIAccessiblePattern::get_CurrentChildId.
Return int, the Microsoft Active Accessibility child identifier for the element.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-get_currentchildid
- DefaultAction
- Property DefaultAction.
Call IUIAutomationLegacyIAccessiblePattern::get_CurrentDefaultAction.
Return str, the Microsoft Active Accessibility current default action for the element.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-get_currentdefaultaction
- Description
- Property Description.
Call IUIAutomationLegacyIAccessiblePattern::get_CurrentDescription.
Return str, the Microsoft Active Accessibility description of the element.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-get_currentdescription
- Help
- Property Help.
Call IUIAutomationLegacyIAccessiblePattern::get_CurrentHelp.
Return str, the Microsoft Active Accessibility help string for the element.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-get_currenthelp
- KeyboardShortcut
- Property KeyboardShortcut.
Call IUIAutomationLegacyIAccessiblePattern::get_CurrentKeyboardShortcut.
Return str, the Microsoft Active Accessibility keyboard shortcut property for the element.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-get_currentkeyboardshortcut
- Name
- Property Name.
Call IUIAutomationLegacyIAccessiblePattern::get_CurrentName.
Return str, the Microsoft Active Accessibility name property of the element.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-get_currentname
- Role
- Property Role.
Call IUIAutomationLegacyIAccessiblePattern::get_CurrentRole.
Return int, a value in calss `AccessibleRole`, the Microsoft Active Accessibility role identifier.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-get_currentrole
- State
- Property State.
Call IUIAutomationLegacyIAccessiblePattern::get_CurrentState.
Return int, a value in calss `AccessibleState`, the Microsoft Active Accessibility state identifier.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-get_currentstate
- Value
- Property Value.
Call IUIAutomationLegacyIAccessiblePattern::get_CurrentValue.
Return str, the Microsoft Active Accessibility value property.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationlegacyiaccessiblepattern-get_currentvalue
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class ListControl(Control) |
|
ListControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- ListControl
- Control
- builtins.object
Methods defined here:
- GetGridPattern(self) -> uiautomation.GridPattern
- Return `GridPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetMultipleViewPattern(self) -> uiautomation.MultipleViewPattern
- Return `MultipleViewPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetScrollPattern(self) -> uiautomation.ScrollPattern
- Return `ScrollPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionPattern(self) -> uiautomation.SelectionPattern
- Return `SelectionPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class ListItemControl(Control) |
|
ListItemControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- ListItemControl
- Control
- builtins.object
Methods defined here:
- GetExpandCollapsePattern(self) -> uiautomation.ExpandCollapsePattern
- Return `ExpandCollapsePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetGridItemPattern(self) -> uiautomation.GridItemPattern
- Return `GridItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetInvokePattern(self) -> uiautomation.InvokePattern
- Return `InvokePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetScrollItemPattern(self) -> uiautomation.ScrollItemPattern
- Return `ScrollItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionItemPattern(self) -> uiautomation.SelectionItemPattern
- Return `SelectionItemPattern` if it supports the pattern else None(Must support according to MSDN).
- GetTogglePattern(self) -> uiautomation.TogglePattern
- Return `TogglePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetValuePattern(self) -> uiautomation.ValuePattern
- Return `ValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class Logger(builtins.object) |
|
Logger for print and log. Support for printing log with different colors on console. |
|
Static methods defined here:
- ColorfullyLog(log: str = '', consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: Optional[str] = None) -> None
- log: any type.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
logFile: str, log file path.
ColorfullyLog('Hello <Color=Green>Green Text</Color> !!!'), Color name must be in `Logger.ColorNames` and can't be nested.
- ColorfullyWrite(log: str, consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: Optional[str] = None) -> None
- log: str.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
logFile: str, log file path.
ColorfullyWrite('Hello <Color=Green>Green Text</Color> !!!'), Color name must be in `Logger.ColorNames` and can't be nested.
- ColorfullyWriteLine(log: str, consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: Optional[str] = None) -> None
- log: str.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
logFile: str, log file path.
ColorfullyWriteLine('Hello <Color=Green>Green Text</Color> !!!'), Color name must be in `Logger.ColorNames` and can't be nested.
- DeleteLog() -> None
- Delete log file.
- Log(log: Any = '', consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: Optional[str] = None) -> None
- log: any type.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
logFile: str, log file path.
- LogColorfully = ColorfullyLog(log: str = '', consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: Optional[str] = None) -> None
- log: any type.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
logFile: str, log file path.
ColorfullyLog('Hello <Color=Green>Green Text</Color> !!!'), Color name must be in `Logger.ColorNames` and can't be nested.
- SetLogFile(logFile: Union[_io.TextIOWrapper, str]) -> None
- logFile: file object or str.
If logFile is '', no log file will be written.
The previous log file will be closed immediately.
- Write(log: Any, consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: Optional[str] = None, printTruncateLen: int = 0) -> None
- log: any type.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
logFile: str, log file path.
printTruncateLen: int, if <= 0, log is not truncated when print.
- WriteColorfully = ColorfullyWrite(log: str, consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: Optional[str] = None) -> None
- log: str.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
logFile: str, log file path.
ColorfullyWrite('Hello <Color=Green>Green Text</Color> !!!'), Color name must be in `Logger.ColorNames` and can't be nested.
- WriteLine(log: Any, consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: Optional[str] = None) -> None
- log: any type.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
logFile: str, log file path.
- WriteLineColorfully = ColorfullyWriteLine(log: str, consoleColor: int = -1, writeToFile: bool = True, printToStdout: bool = True, logFile: Optional[str] = None) -> None
- log: str.
consoleColor: int, a value in class `ConsoleColor`, such as `ConsoleColor.DarkGreen`.
writeToFile: bool.
printToStdout: bool.
logFile: str, log file path.
ColorfullyWriteLine('Hello <Color=Green>Green Text</Color> !!!'), Color name must be in `Logger.ColorNames` and can't be nested.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- ColorNames = {'Black': 0, 'Blue': 9, 'Cyan': 11, 'DarkBlue': 1, 'DarkCyan': 3, 'DarkGray': 8, 'DarkGreen': 2, 'DarkMagenta': 5, 'DarkRed': 4, 'DarkYellow': 6, ...}
- FileObj = None
- FilePath = '@AutomationLog.txt'
- FlushTime = 1140369.6983334
|
class MB(builtins.object) |
|
MessageBox flags from Win32. |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- AbortRetryIgnore = 2
- ApplModal = 0
- CancelTryContinue = 6
- DefButton1 = 0
- DefButton2 = 256
- DefButton3 = 512
- DefButton4 = 768
- DefMask = 3840
- DefaultDesktopOnly = 131072
- Help = 16384
- IconAsterisk = 64
- IconError = 16
- IconExclamation = 48
- IconHand = 16
- IconInformation = 64
- IconMask = 240
- IconQuestion = 32
- IconStop = 16
- IconWarning = 48
- IdAbort = 3
- IdCancel = 2
- IdClose = 8
- IdContinue = 11
- IdHelp = 9
- IdIgnore = 5
- IdNo = 7
- IdOk = 1
- IdRetry = 4
- IdTimeout = 32000
- IdTryAgain = 10
- IdYes = 6
- MiscMask = 49152
- ModeMask = 12288
- NoFocus = 32768
- Ok = 0
- OkCancel = 1
- RetryCancel = 5
- Right = 524288
- RtlReading = 1048576
- ServiceNotification = 2097152
- ServiceNotificationNT3X = 262144
- SetForeground = 65536
- SystemModal = 4096
- TaskModal = 8192
- Topmost = 262144
- TypeMask = 15
- UserIcon = 128
- YesNo = 4
- YesNoCancel = 3
|
class MenuBarControl(Control) |
|
MenuBarControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- MenuBarControl
- Control
- builtins.object
Methods defined here:
- GetDockPattern(self) -> uiautomation.DockPattern
- Return `DockPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetExpandCollapsePattern(self) -> uiautomation.ExpandCollapsePattern
- Return `ExpandCollapsePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTransformPattern(self) -> uiautomation.TransformPattern
- Return `TransformPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class MenuControl(Control) |
|
MenuControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- MenuControl
- Control
- builtins.object
Methods defined here:
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class MenuItemControl(Control) |
|
MenuItemControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- MenuItemControl
- Control
- builtins.object
Methods defined here:
- GetExpandCollapsePattern(self) -> uiautomation.ExpandCollapsePattern
- Return `ExpandCollapsePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetInvokePattern(self) -> uiautomation.InvokePattern
- Return `InvokePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionItemPattern(self) -> uiautomation.SelectionItemPattern
- Return `SelectionItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTogglePattern(self) -> uiautomation.TogglePattern
- Return `TogglePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class ModifierKey(builtins.object) |
|
ModifierKey from Win32. |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- Alt = 1
- Control = 2
- NoRepeat = 16384
- Shift = 4
- Win = 8
|
class MouseEventFlag(builtins.object) |
|
MouseEventFlag from Win32. |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- Absolute = 32768
- HWheel = 4096
- LeftDown = 2
- LeftUp = 4
- MiddleDown = 32
- MiddleUp = 64
- Move = 1
- MoveNoCoalesce = 8192
- RightDown = 8
- RightUp = 16
- VirtualDesk = 16384
- Wheel = 2048
- XDown = 128
- XUp = 256
|
class MultipleViewPattern(builtins.object) |
|
MultipleViewPattern(pattern=None)
|
|
Methods defined here:
- GetSupportedViews(self) -> List[int]
- Call IUIAutomationMultipleViewPattern::GetCurrentSupportedViews, todo.
Return List[int], a list of int, control-specific view identifiers.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationmultipleviewpattern-getcurrentsupportedviews
- GetViewName(self, view: int) -> str
- Call IUIAutomationMultipleViewPattern::GetViewName.
view: int, the control-specific view identifier.
Return str, the name of a control-specific view.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationmultipleviewpattern-getviewname
- SetView(self, view: int) -> bool
- Call IUIAutomationMultipleViewPattern::SetCurrentView.
Set the view of the control.
view: int, the control-specific view identifier.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationmultipleviewpattern-setcurrentview
- __init__(self, pattern=None)
- Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationmultipleviewpattern
Readonly properties defined here:
- CurrentView
- Property CurrentView.
Call IUIAutomationMultipleViewPattern::get_CurrentCurrentView.
Return int, the control-specific identifier of the current view of the control.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationmultipleviewpattern-get_currentcurrentview
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class PaneControl(Control, TopLevel) |
|
PaneControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- PaneControl
- Control
- TopLevel
- builtins.object
Methods defined here:
- GetDockPattern(self) -> uiautomation.DockPattern
- Return `DockPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetScrollPattern(self) -> uiautomation.ScrollPattern
- Return `ScrollPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTransformPattern(self) -> uiautomation.TransformPattern
- Return `TransformPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
Methods inherited from TopLevel:
- IsMaximize(self) -> bool
- IsMinimize(self) -> bool
- IsTopmost(self) -> bool
- Maximize(self, waitTime: float = 0.5) -> bool
- Set top level window maximize.
- Minimize(self, waitTime: float = 0.5) -> bool
- MoveToCenter(self) -> bool
- Move window to screen center.
- Restore(self, waitTime: float = 0.5) -> bool
- Restore window to normal state.
Similar to SwitchToThisWindow.
- SetActive(self, waitTime: float = 0.5) -> bool
- Set top level window active.
- SetTopmost(self, isTopmost: bool = True, waitTime: float = 0.5) -> bool
- Set top level window topmost.
isTopmost: bool.
waitTime: float.
- SwitchToThisWindow(self, waitTime: float = 0.5) -> None
|
class PatternId(builtins.object) |
|
PatternId from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-controlpattern-ids |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- AnnotationPattern = 10023
- CustomNavigationPattern = 10033
- DockPattern = 10011
- DragPattern = 10030
- DropTargetPattern = 10031
- ExpandCollapsePattern = 10005
- GridItemPattern = 10007
- GridPattern = 10006
- InvokePattern = 10000
- ItemContainerPattern = 10019
- LegacyIAccessiblePattern = 10018
- MultipleViewPattern = 10008
- ObjectModelPattern = 10022
- RangeValuePattern = 10003
- ScrollItemPattern = 10017
- ScrollPattern = 10004
- SelectionItemPattern = 10010
- SelectionPattern = 10001
- SpreadsheetItemPattern = 10027
- SpreadsheetPattern = 10026
- StylesPattern = 10025
- SynchronizedInputPattern = 10021
- TableItemPattern = 10013
- TablePattern = 10012
- TextChildPattern = 10029
- TextEditPattern = 10032
- TextPattern = 10014
- TextPattern2 = 10024
- TogglePattern = 10015
- TransformPattern = 10016
- TransformPattern2 = 10028
- ValuePattern = 10002
- VirtualizedItemPattern = 10020
- WindowPattern = 10009
|
class ProcessDpiAwareness(builtins.object) |
| |
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- DpiUnaware = 0
- PerMonitorDpiAware = 2
- SystemDpiAware = 1
|
class ProcessInfo(builtins.object) |
|
ProcessInfo(exeName: str, pid: int, ppid: int = -1, exePath: str = '', cmdLine: str = '')
|
|
Methods defined here:
- __init__(self, exeName: str, pid: int, ppid: int = -1, exePath: str = '', cmdLine: str = '')
- Initialize self. See help(type(self)) for accurate signature.
- __repr__(self)
- Return repr(self).
- __str__(self)
- Return str(self).
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class ProgressBarControl(Control) |
|
ProgressBarControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- ProgressBarControl
- Control
- builtins.object
Methods defined here:
- GetRangeValuePattern(self) -> uiautomation.RangeValuePattern
- Return `RangeValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetValuePattern(self) -> uiautomation.ValuePattern
- Return `ValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class PropertyId(builtins.object) |
|
PropertyId from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-control-pattern-propids |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- AcceleratorKeyProperty = 30006
- AccessKeyProperty = 30007
- AnnotationAnnotationTypeIdProperty = 30113
- AnnotationAnnotationTypeNameProperty = 30114
- AnnotationAuthorProperty = 30115
- AnnotationDateTimeProperty = 30116
- AnnotationObjectsProperty = 30156
- AnnotationTargetProperty = 30117
- AnnotationTypesProperty = 30155
- AriaPropertiesProperty = 30102
- AriaRoleProperty = 30101
- AutomationIdProperty = 30011
- BoundingRectangleProperty = 30001
- CenterPointProperty = 30165
- ClassNameProperty = 30012
- ClickablePointProperty = 30014
- ControlTypeProperty = 30003
- ControllerForProperty = 30104
- CultureProperty = 30015
- DescribedByProperty = 30105
- DockDockPositionProperty = 30069
- DragDropEffectProperty = 30139
- DragDropEffectsProperty = 30140
- DragGrabbedItemsProperty = 30144
- DragIsGrabbedProperty = 30138
- DropTargetDropTargetEffectProperty = 30142
- DropTargetDropTargetEffectsProperty = 30143
- ExpandCollapseExpandCollapseStateProperty = 30070
- FillColorProperty = 30160
- FillTypeProperty = 30162
- FlowsFromProperty = 30148
- FlowsToProperty = 30106
- FrameworkIdProperty = 30024
- FullDescriptionProperty = 30159
- GridColumnCountProperty = 30063
- GridItemColumnProperty = 30065
- GridItemColumnSpanProperty = 30067
- GridItemContainingGridProperty = 30068
- GridItemRowProperty = 30064
- GridItemRowSpanProperty = 30066
- GridRowCountProperty = 30062
- HasKeyboardFocusProperty = 30008
- HelpTextProperty = 30013
- IsAnnotationPatternAvailableProperty = 30118
- IsContentElementProperty = 30017
- IsControlElementProperty = 30016
- IsCustomNavigationPatternAvailableProperty = 30151
- IsDataValidForFormProperty = 30103
- IsDockPatternAvailableProperty = 30027
- IsDragPatternAvailableProperty = 30137
- IsDropTargetPatternAvailableProperty = 30141
- IsEnabledProperty = 30010
- IsExpandCollapsePatternAvailableProperty = 30028
- IsGridItemPatternAvailableProperty = 30029
- IsGridPatternAvailableProperty = 30030
- IsInvokePatternAvailableProperty = 30031
- IsItemContainerPatternAvailableProperty = 30108
- IsKeyboardFocusableProperty = 30009
- IsLegacyIAccessiblePatternAvailableProperty = 30090
- IsMultipleViewPatternAvailableProperty = 30032
- IsObjectModelPatternAvailableProperty = 30112
- IsOffscreenProperty = 30022
- IsPasswordProperty = 30019
- IsPeripheralProperty = 30150
- IsRangeValuePatternAvailableProperty = 30033
- IsRequiredForFormProperty = 30025
- IsScrollItemPatternAvailableProperty = 30035
- IsScrollPatternAvailableProperty = 30034
- IsSelectionItemPatternAvailableProperty = 30036
- IsSelectionPattern2AvailableProperty = 30168
- IsSelectionPatternAvailableProperty = 30037
- IsSpreadsheetItemPatternAvailableProperty = 30132
- IsSpreadsheetPatternAvailableProperty = 30128
- IsStylesPatternAvailableProperty = 30127
- IsSynchronizedInputPatternAvailableProperty = 30110
- IsTableItemPatternAvailableProperty = 30039
- IsTablePatternAvailableProperty = 30038
- IsTextChildPatternAvailableProperty = 30136
- IsTextEditPatternAvailableProperty = 30149
- IsTextPattern2AvailableProperty = 30119
- IsTextPatternAvailableProperty = 30040
- IsTogglePatternAvailableProperty = 30041
- IsTransformPattern2AvailableProperty = 30134
- IsTransformPatternAvailableProperty = 30042
- IsValuePatternAvailableProperty = 30043
- IsVirtualizedItemPatternAvailableProperty = 30109
- IsWindowPatternAvailableProperty = 30044
- ItemStatusProperty = 30026
- ItemTypeProperty = 30021
- LabeledByProperty = 30018
- LandmarkTypeProperty = 30157
- LegacyIAccessibleChildIdProperty = 30091
- LegacyIAccessibleDefaultActionProperty = 30100
- LegacyIAccessibleDescriptionProperty = 30094
- LegacyIAccessibleHelpProperty = 30097
- LegacyIAccessibleKeyboardShortcutProperty = 30098
- LegacyIAccessibleNameProperty = 30092
- LegacyIAccessibleRoleProperty = 30095
- LegacyIAccessibleSelectionProperty = 30099
- LegacyIAccessibleStateProperty = 30096
- LegacyIAccessibleValueProperty = 30093
- LevelProperty = 30154
- LiveSettingProperty = 30135
- LocalizedControlTypeProperty = 30004
- LocalizedLandmarkTypeProperty = 30158
- MultipleViewCurrentViewProperty = 30071
- MultipleViewSupportedViewsProperty = 30072
- NameProperty = 30005
- NativeWindowHandleProperty = 30020
- OptimizeForVisualContentProperty = 30111
- OrientationProperty = 30023
- OutlineColorProperty = 30161
- OutlineThicknessProperty = 30164
- PositionInSetProperty = 30152
- ProcessIdProperty = 30002
- ProviderDescriptionProperty = 30107
- RangeValueIsReadOnlyProperty = 30048
- RangeValueLargeChangeProperty = 30051
- RangeValueMaximumProperty = 30050
- RangeValueMinimumProperty = 30049
- RangeValueSmallChangeProperty = 30052
- RangeValueValueProperty = 30047
- RotationProperty = 30166
- RuntimeIdProperty = 30000
- ScrollHorizontalScrollPercentProperty = 30053
- ScrollHorizontalViewSizeProperty = 30054
- ScrollHorizontallyScrollableProperty = 30057
- ScrollVerticalScrollPercentProperty = 30055
- ScrollVerticalViewSizeProperty = 30056
- ScrollVerticallyScrollableProperty = 30058
- Selection2CurrentSelectedItemProperty = 30171
- Selection2FirstSelectedItemProperty = 30169
- Selection2ItemCountProperty = 30172
- Selection2LastSelectedItemProperty = 30170
- SelectionCanSelectMultipleProperty = 30060
- SelectionIsSelectionRequiredProperty = 30061
- SelectionItemIsSelectedProperty = 30079
- SelectionItemSelectionContainerProperty = 30080
- SelectionSelectionProperty = 30059
- SizeOfSetProperty = 30153
- SizeProperty = 30167
- SpreadsheetItemAnnotationObjectsProperty = 30130
- SpreadsheetItemAnnotationTypesProperty = 30131
- SpreadsheetItemFormulaProperty = 30129
- StylesExtendedPropertiesProperty = 30126
- StylesFillColorProperty = 30122
- StylesFillPatternColorProperty = 30125
- StylesFillPatternStyleProperty = 30123
- StylesShapeProperty = 30124
- StylesStyleIdProperty = 30120
- StylesStyleNameProperty = 30121
- TableColumnHeadersProperty = 30082
- TableItemColumnHeaderItemsProperty = 30085
- TableItemRowHeaderItemsProperty = 30084
- TableRowHeadersProperty = 30081
- TableRowOrColumnMajorProperty = 30083
- ToggleToggleStateProperty = 30086
- Transform2CanZoomProperty = 30133
- Transform2ZoomLevelProperty = 30145
- Transform2ZoomMaximumProperty = 30147
- Transform2ZoomMinimumProperty = 30146
- TransformCanMoveProperty = 30087
- TransformCanResizeProperty = 30088
- TransformCanRotateProperty = 30089
- ValueIsReadOnlyProperty = 30046
- ValueValueProperty = 30045
- VisualEffectsProperty = 30163
- WindowCanMaximizeProperty = 30073
- WindowCanMinimizeProperty = 30074
- WindowIsModalProperty = 30077
- WindowIsTopmostProperty = 30078
- WindowWindowInteractionStateProperty = 30076
- WindowWindowVisualStateProperty = 30075
|
class RadioButtonControl(Control) |
|
RadioButtonControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- RadioButtonControl
- Control
- builtins.object
Methods defined here:
- GetSelectionItemPattern(self) -> uiautomation.SelectionItemPattern
- Return `SelectionItemPattern` if it supports the pattern else None(Must support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class RangeValuePattern(builtins.object) |
|
RangeValuePattern(pattern=None)
|
|
Methods defined here:
- SetValue(self, value: float, waitTime: float = 0.5) -> bool
- Call IUIAutomationRangeValuePattern::SetValue.
Set the value of the control.
value: int.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationrangevaluepattern-setvalue
- __init__(self, pattern=None)
- Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationrangevaluepattern
Readonly properties defined here:
- IsReadOnly
- Property IsReadOnly.
Call IUIAutomationRangeValuePattern::get_CurrentIsReadOnly.
Return bool, indicates whether the value of the element can be changed.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationrangevaluepattern-get_currentisreadonly
- LargeChange
- Property LargeChange.
Call IUIAutomationRangeValuePattern::get_CurrentLargeChange.
Return float, the value that is added to or subtracted from the value of the control
when a large change is made, such as when the PAGE DOWN key is pressed.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationrangevaluepattern-get_currentlargechange
- Maximum
- Property Maximum.
Call IUIAutomationRangeValuePattern::get_CurrentMaximum.
Return float, the maximum value of the control.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationrangevaluepattern-get_currentmaximum
- Minimum
- Property Minimum.
Call IUIAutomationRangeValuePattern::get_CurrentMinimum.
Return float, the minimum value of the control.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationrangevaluepattern-get_currentminimum
- SmallChange
- Property SmallChange.
Call IUIAutomationRangeValuePattern::get_CurrentSmallChange.
Return float, the value that is added to or subtracted from the value of the control
when a small change is made, such as when an arrow key is pressed.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationrangevaluepattern-get_currentsmallchange
- Value
- Property Value.
Call IUIAutomationRangeValuePattern::get_CurrentValue.
Return float, the value of the control.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationrangevaluepattern-get_currentvalue
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class Rect(builtins.object) |
|
Rect(left: int = 0, top: int = 0, right: int = 0, bottom: int = 0)
class Rect, like `ctypes.wintypes.RECT`. |
|
Methods defined here:
- __eq__(self, rect)
- Return self==value.
- __init__(self, left: int = 0, top: int = 0, right: int = 0, bottom: int = 0)
- Initialize self. See help(type(self)) for accurate signature.
- __repr__(self) -> str
- Return repr(self).
- __str__(self) -> str
- Return str(self).
- contains(self, x: int, y: int) -> bool
- height(self) -> int
- intersect(self, rect: 'Rect') -> 'Rect'
- isempty(self) -> int
- offset(self, x: int, y: int) -> None
- width(self) -> int
- xcenter(self) -> int
- ycenter(self) -> int
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- __hash__ = None
|
class RotateFlipType(builtins.object) |
| |
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- Rotate180FlipNone = 2
- Rotate180FlipX = 6
- Rotate180FlipXY = 0
- Rotate180FlipY = 4
- Rotate270FlipNone = 3
- Rotate270FlipX = 7
- Rotate270FlipXY = 1
- Rotate270FlipY = 5
- Rotate90FlipNone = 1
- Rotate90FlipX = 5
- Rotate90FlipXY = 3
- Rotate90FlipY = 7
- RotateNoneFlipNone = 0
- RotateNoneFlipX = 4
- RotateNoneFlipXY = 2
- RotateNoneFlipY = 6
|
class SW(builtins.object) |
|
ShowWindow params from Win32. |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- ForceMinimize = 11
- Hide = 0
- Max = 11
- Maximize = 3
- Minimize = 6
- Normal = 1
- Restore = 9
- Show = 5
- ShowDefault = 10
- ShowMaximized = 3
- ShowMinNoActive = 7
- ShowMinimized = 2
- ShowNA = 8
- ShowNoActivate = 4
- ShowNormal = 1
|
class SWP(builtins.object) |
|
SetWindowPos params from Win32. |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- HWND_Bottom = 1
- HWND_NoTopmost = -2
- HWND_Top = 0
- HWND_Topmost = -1
- SWP_AsyncWindowPos = 16384
- SWP_DeferErase = 8192
- SWP_DrawFrame = 32
- SWP_FrameChanged = 32
- SWP_HideWindow = 128
- SWP_NoActivate = 16
- SWP_NoCopyBits = 256
- SWP_NoMove = 2
- SWP_NoOwnerZOrder = 512
- SWP_NoRedraw = 8
- SWP_NoReposition = 512
- SWP_NoSendChanging = 1024
- SWP_NoSize = 1
- SWP_NoZOrder = 4
- SWP_ShowWindow = 64
|
class ScrollBarControl(Control) |
|
ScrollBarControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- ScrollBarControl
- Control
- builtins.object
Methods defined here:
- GetRangeValuePattern(self) -> uiautomation.RangeValuePattern
- Return `RangeValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class ScrollPattern(builtins.object) |
|
ScrollPattern(pattern=None)
|
|
Methods defined here:
- Scroll(self, horizontalAmount: int, verticalAmount: int, waitTime: float = 0.5) -> bool
- Call IUIAutomationScrollPattern::Scroll.
Scroll the visible region of the content area horizontally and vertically.
horizontalAmount: int, a value in ScrollAmount.
verticalAmount: int, a value in ScrollAmount.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-scroll
- SetScrollPercent(self, horizontalPercent: float, verticalPercent: float, waitTime: float = 0.5) -> bool
- Call IUIAutomationScrollPattern::SetScrollPercent.
Set the horizontal and vertical scroll positions as a percentage of the total content area within the UI Automation element.
horizontalPercent: float or int, a value in [0, 100] or ScrollPattern.NoScrollValue(-1) if no scroll.
verticalPercent: float or int, a value in [0, 100] or ScrollPattern.NoScrollValue(-1) if no scroll.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-setscrollpercent
- __init__(self, pattern=None)
- Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationscrollpattern
Readonly properties defined here:
- HorizontalScrollPercent
- Property HorizontalScrollPercent.
Call IUIAutomationScrollPattern::get_CurrentHorizontalScrollPercent.
Return float, the horizontal scroll position.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-get_currenthorizontalscrollpercent
- HorizontalViewSize
- Property HorizontalViewSize.
Call IUIAutomationScrollPattern::get_CurrentHorizontalViewSize.
Return float, the horizontal size of the viewable region of a scrollable element.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-get_currenthorizontalviewsize
- HorizontallyScrollable
- Property HorizontallyScrollable.
Call IUIAutomationScrollPattern::get_CurrentHorizontallyScrollable.
Return bool, indicates whether the element can scroll horizontally.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-get_currenthorizontallyscrollable
- VerticalScrollPercent
- Property VerticalScrollPercent.
Call IUIAutomationScrollPattern::get_CurrentVerticalScrollPercent.
Return float, the vertical scroll position.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-get_currentverticalscrollpercent
- VerticalViewSize
- Property VerticalViewSize.
Call IUIAutomationScrollPattern::get_CurrentVerticalViewSize.
Return float, the vertical size of the viewable region of a scrollable element.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-get_currentverticalviewsize
- VerticallyScrollable
- Property VerticallyScrollable.
Call IUIAutomationScrollPattern::get_CurrentVerticallyScrollable.
Return bool, indicates whether the element can scroll vertically.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationscrollpattern-get_currentverticallyscrollable
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- NoScrollValue = -1
|
class SemanticZoomControl(Control) |
|
SemanticZoomControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- SemanticZoomControl
- Control
- builtins.object
Methods defined here:
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class SeparatorControl(Control) |
|
SeparatorControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- SeparatorControl
- Control
- builtins.object
Methods defined here:
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class SliderControl(Control) |
|
SliderControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- SliderControl
- Control
- builtins.object
Methods defined here:
- GetRangeValuePattern(self) -> uiautomation.RangeValuePattern
- Return `RangeValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionPattern(self) -> uiautomation.SelectionPattern
- Return `SelectionPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetValuePattern(self) -> uiautomation.ValuePattern
- Return `ValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class SpinnerControl(Control) |
|
SpinnerControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- SpinnerControl
- Control
- builtins.object
Methods defined here:
- GetRangeValuePattern(self) -> uiautomation.RangeValuePattern
- Return `RangeValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionPattern(self) -> uiautomation.SelectionPattern
- Return `SelectionPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetValuePattern(self) -> uiautomation.ValuePattern
- Return `ValuePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class SplitButtonControl(Control) |
|
SplitButtonControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- SplitButtonControl
- Control
- builtins.object
Methods defined here:
- GetExpandCollapsePattern(self) -> uiautomation.ExpandCollapsePattern
- Return `ExpandCollapsePattern` if it supports the pattern else None(Must support according to MSDN).
- GetInvokePattern(self) -> uiautomation.InvokePattern
- Return `InvokePattern` if it supports the pattern else None(Must support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class StatusBarControl(Control) |
|
StatusBarControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- StatusBarControl
- Control
- builtins.object
Methods defined here:
- GetGridPattern(self) -> uiautomation.GridPattern
- Return `GridPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class StyleId(builtins.object) |
|
StyleId from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-style-identifiers |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- BulletedList = 70015
- Custom = 70000
- Emphasis = 70013
- Heading1 = 70001
- Heading2 = 70002
- Heading3 = 70003
- Heading4 = 70004
- Heading5 = 70005
- Heading6 = 70006
- Heading7 = 70007
- Heading8 = 70008
- Heading9 = 70009
- Normal = 70012
- NumberedList = 70016
- Quote = 70014
- Subtitle = 70011
- Title = 70010
|
class TabControl(Control) |
|
TabControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- TabControl
- Control
- builtins.object
Methods defined here:
- GetScrollPattern(self) -> uiautomation.ScrollPattern
- Return `ScrollPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionPattern(self) -> uiautomation.SelectionPattern
- Return `SelectionPattern` if it supports the pattern else None(Must support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class TabItemControl(Control) |
|
TabItemControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- TabItemControl
- Control
- builtins.object
Methods defined here:
- GetSelectionItemPattern(self) -> uiautomation.SelectionItemPattern
- Return `SelectionItemPattern` if it supports the pattern else None(Must support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class TableControl(Control) |
|
TableControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- TableControl
- Control
- builtins.object
Methods defined here:
- GetGridItemPattern(self) -> uiautomation.GridItemPattern
- Return `GridItemPattern` if it supports the pattern else None(Must support according to MSDN).
- GetGridPattern(self) -> uiautomation.GridPattern
- Return `GridPattern` if it supports the pattern else None(Must support according to MSDN).
- GetTableItemPattern(self) -> uiautomation.TableItemPattern
- Return `TableItemPattern` if it supports the pattern else None(Must support according to MSDN).
- GetTableItemsValue(self, row: int = -1, column: int = -1)
- Get the value of a table
row: int. Position of the row in the table
column: int. Position of the column in the table
Return a list with values in the table.
If a row and column is specified, return a cell value.
If only a row is specified, return a list with row values
- GetTablePattern(self) -> uiautomation.TablePattern
- Return `TablePattern` if it supports the pattern else None(Must support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class TextAttributeId(builtins.object) |
|
TextAttributeId from IUIAutomation.
Refer https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-textattribute-ids |
|
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- AfterParagraphSpacingAttribute = 40042
- AnimationStyleAttribute = 40000
- AnnotationObjectsAttribute = 40032
- AnnotationTypesAttribute = 40031
- BackgroundColorAttribute = 40001
- BeforeParagraphSpacingAttribute = 40041
- BulletStyleAttribute = 40002
- CapStyleAttribute = 40003
- CaretBidiModeAttribute = 40039
- CaretPositionAttribute = 40038
- CultureAttribute = 40004
- FontNameAttribute = 40005
- FontSizeAttribute = 40006
- FontWeightAttribute = 40007
- ForegroundColorAttribute = 40008
- HorizontalTextAlignmentAttribute = 40009
- IndentationFirstLineAttribute = 40010
- IndentationLeadingAttribute = 40011
- IndentationTrailingAttribute = 40012
- IsActiveAttribute = 40036
- IsHiddenAttribute = 40013
- IsItalicAttribute = 40014
- IsReadOnlyAttribute = 40015
- IsSubscriptAttribute = 40016
- IsSuperscriptAttribute = 40017
- LineSpacingAttribute = 40040
- LinkAttribute = 40035
- MarginBottomAttribute = 40018
- MarginLeadingAttribute = 40019
- MarginTopAttribute = 40020
- MarginTrailingAttribute = 40021
- OutlineStylesAttribute = 40022
- OverlineColorAttribute = 40023
- OverlineStyleAttribute = 40024
- SayAsInterpretAsAttribute = 40043
- SelectionActiveEndAttribute = 40037
- StrikethroughColorAttribute = 40025
- StrikethroughStyleAttribute = 40026
- StyleIdAttribute = 40034
- StyleNameAttribute = 40033
- TabsAttribute = 40027
- TextFlowDirectionsAttribute = 40028
- UnderlineColorAttribute = 40029
- UnderlineStyleAttribute = 40030
|
class TextControl(Control) |
|
TextControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- TextControl
- Control
- builtins.object
Methods defined here:
- GetGridItemPattern(self) -> uiautomation.GridItemPattern
- Return `GridItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTableItemPattern(self) -> uiautomation.TableItemPattern
- Return `TableItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTextPattern(self) -> uiautomation.TextPattern
- Return `TextPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class TextPattern(builtins.object) |
|
TextPattern(pattern=None)
|
|
Methods defined here:
- GetSelection(self) -> List[uiautomation.TextRange]
- Call IUIAutomationTextPattern::GetSelection.
Return List[TextRange], a list of `TextRange`, represents the currently selected text in a text-based control.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-getselection
- GetVisibleRanges(self) -> List[uiautomation.TextRange]
- Call IUIAutomationTextPattern::GetVisibleRanges.
Return List[TextRange], a list of `TextRange`, disjoint text ranges from a text-based control
where each text range represents a contiguous span of visible text.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-getvisibleranges
- RangeFromChild(self, child) -> Optional[uiautomation.TextRange]
- Call IUIAutomationTextPattern::RangeFromChild.
child: `Control` or its subclass.
Return `TextRange` or None, a text range enclosing a child element such as an image,
hyperlink, Microsoft Excel spreadsheet, or other embedded object.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-rangefromchild
- RangeFromPoint(self, x: int, y: int) -> Optional[uiautomation.TextRange]
- Call IUIAutomationTextPattern::RangeFromPoint.
child: `Control` or its subclass.
Return `TextRange` or None, the degenerate (empty) text range nearest to the specified screen coordinates.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-rangefrompoint
- __init__(self, pattern=None)
- Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationtextpattern
Readonly properties defined here:
- DocumentRange
- Property DocumentRange.
Call IUIAutomationTextPattern::get_DocumentRange.
Return `TextRange`, a text range that encloses the main text of a document.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-get_documentrange
- SupportedTextSelection
- Property SupportedTextSelection.
Call IUIAutomationTextPattern::get_SupportedTextSelection.
Return bool, specifies the type of text selection that is supported by the control.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextpattern-get_supportedtextselection
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class TextRange(builtins.object) |
|
TextRange(textRange=None)
|
|
Methods defined here:
- AddToSelection(self, waitTime: float = 0.5) -> bool
- Call IUIAutomationTextRange::AddToSelection.
Add the text range to the collection of selected text ranges in a control that supports multiple, disjoint spans of selected text.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-addtoselection
- Clone(self) -> 'TextRange'
- Call IUIAutomationTextRange::Clone.
return `TextRange`, identical to the original and inheriting all properties of the original.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-clone
- Compare(self, textRange: 'TextRange') -> bool
- Call IUIAutomationTextRange::Compare.
textRange: `TextRange`.
Return bool, specifies whether this text range has the same endpoints as another text range.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-compare
- CompareEndpoints(self, srcEndPoint: int, textRange: 'TextRange', targetEndPoint: int) -> int
- Call IUIAutomationTextRange::CompareEndpoints.
srcEndPoint: int, a value in class `TextPatternRangeEndpoint`.
textRange: `TextRange`.
targetEndPoint: int, a value in class `TextPatternRangeEndpoint`.
Return int, a negative value if the caller's endpoint occurs earlier in the text than the target endpoint;
0 if the caller's endpoint is at the same location as the target endpoint;
or a positive value if the caller's endpoint occurs later in the text than the target endpoint.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-compareendpoints
- ExpandToEnclosingUnit(self, unit: int, waitTime: float = 0.5) -> bool
- Call IUIAutomationTextRange::ExpandToEnclosingUnit.
Normalize the text range by the specified text unit.
The range is expanded if it is smaller than the specified unit,
or shortened if it is longer than the specified unit.
unit: int, a value in class `TextUnit`.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-expandtoenclosingunit
- FindAttribute(self, textAttributeId: int, val, backward: bool) -> Optional[ForwardRef('TextRange')]
- Call IUIAutomationTextRange::FindAttribute.
textAttributeID: int, a value in class `TextAttributeId`.
val: COM VARIANT according to textAttributeId? todo.
backward: bool, True if the last occurring text range should be returned instead of the first; otherwise False.
return `TextRange` or None, a text range subset that has the specified text attribute value.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-findattribute
- FindText(self, text: str, backward: bool, ignoreCase: bool) -> Optional[ForwardRef('TextRange')]
- Call IUIAutomationTextRange::FindText.
text: str,
backward: bool, True if the last occurring text range should be returned instead of the first; otherwise False.
ignoreCase: bool, True if case should be ignored; otherwise False.
return `TextRange` or None, a text range subset that contains the specified text.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-findtext
- GetAttributeValue(self, textAttributeId: int) -> comtypes.POINTER(IUnknown)
- Call IUIAutomationTextRange::GetAttributeValue.
textAttributeId: int, a value in class `TextAttributeId`.
Return `ctypes.POINTER(comtypes.IUnknown)` or None, the value of the specified text attribute across the entire text range, todo.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getattributevalue
- GetBoundingRectangles(self) -> List[uiautomation.Rect]
- Call IUIAutomationTextRange::GetBoundingRectangles.
textAttributeId: int, a value in class `TextAttributeId`.
Return List[Rect], a list of `Rect`.
bounding rectangles for each fully or partially visible line of text in a text range..
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getboundingrectangles
for rect in textRange.GetBoundingRectangles():
print(rect.left, rect.top, rect.right, rect.bottom, rect.width(), rect.height(), rect.xcenter(), rect.ycenter())
- GetChildren(self) -> List[ForwardRef('Control')]
- Call IUIAutomationTextRange::GetChildren.
textAttributeId: int, a value in class `TextAttributeId`.
Return List[Control], a list of `Control` subclasses, embedded objects that fall within the text range..
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getchildren
- GetEnclosingControl(self) -> 'Control'
- Call IUIAutomationTextRange::GetEnclosingElement.
Return `Control` subclass, the innermost UI Automation element that encloses the text range.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-getenclosingelement
- GetText(self, maxLength: int = -1) -> str
- Call IUIAutomationTextRange::GetText.
maxLength: int, the maximum length of the string to return, or -1 if no limit is required.
Return str, the plain text of the text range.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-gettext
- Move(self, unit: int, count: int, waitTime: float = 0.5) -> int
- Call IUIAutomationTextRange::Move.
Move the text range forward or backward by the specified number of text units.
unit: int, a value in class `TextUnit`.
count: int, the number of text units to move.
A positive value moves the text range forward.
A negative value moves the text range backward. Zero has no effect.
waitTime: float.
Return: int, the number of text units actually moved.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-move
- MoveEndpointByRange(self, srcEndPoint: int, textRange: 'TextRange', targetEndPoint: int, waitTime: float = 0.5) -> bool
- Call IUIAutomationTextRange::MoveEndpointByRange.
Move one endpoint of the current text range to the specified endpoint of a second text range.
srcEndPoint: int, a value in class `TextPatternRangeEndpoint`.
textRange: `TextRange`.
targetEndPoint: int, a value in class `TextPatternRangeEndpoint`.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-moveendpointbyrange
- MoveEndpointByUnit(self, endPoint: int, unit: int, count: int, waitTime: float = 0.5) -> int
- Call IUIAutomationTextRange::MoveEndpointByUnit.
Move one endpoint of the text range the specified number of text units within the document range.
endPoint: int, a value in class `TextPatternRangeEndpoint`.
unit: int, a value in class `TextUnit`.
count: int, the number of units to move.
A positive count moves the endpoint forward.
A negative count moves backward.
A count of 0 has no effect.
waitTime: float.
Return int, the count of units actually moved.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-moveendpointbyunit
- RemoveFromSelection(self, waitTime: float = 0.5) -> bool
- Call IUIAutomationTextRange::RemoveFromSelection.
Remove the text range from an existing collection of selected text in a text container that supports multiple, disjoint selections.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-removefromselection
- ScrollIntoView(self, alignTop: bool = True, waitTime: float = 0.5) -> bool
- Call IUIAutomationTextRange::ScrollIntoView.
Cause the text control to scroll until the text range is visible in the viewport.
alignTop: bool, True if the text control should be scrolled so that the text range is flush with the top of the viewport;
False if it should be flush with the bottom of the viewport.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-scrollintoview
- Select(self, waitTime: float = 0.5) -> bool
- Call IUIAutomationTextRange::Select.
Select the span of text that corresponds to this text range, and remove any previous selection.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtextrange-select
- __init__(self, textRange=None)
- Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationtextrange
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class ThumbControl(Control) |
|
ThumbControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- ThumbControl
- Control
- builtins.object
Methods defined here:
- GetTransformPattern(self) -> uiautomation.TransformPattern
- Return `TransformPattern` if it supports the pattern else None(Must support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class TitleBarControl(Control) |
|
TitleBarControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- TitleBarControl
- Control
- builtins.object
Methods defined here:
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class ToolBarControl(Control) |
|
ToolBarControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- ToolBarControl
- Control
- builtins.object
Methods defined here:
- GetDockPattern(self) -> uiautomation.DockPattern
- Return `DockPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetExpandCollapsePattern(self) -> uiautomation.ExpandCollapsePattern
- Return `ExpandCollapsePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTransformPattern(self) -> uiautomation.TransformPattern
- Return `TransformPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class ToolTipControl(Control) |
|
ToolTipControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- ToolTipControl
- Control
- builtins.object
Methods defined here:
- GetTextPattern(self) -> uiautomation.TextPattern
- Return `TextPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetWindowPattern(self) -> uiautomation.WindowPattern
- Return `WindowPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class TopLevel(builtins.object) |
|
Class TopLevel |
|
Methods defined here:
- IsMaximize(self) -> bool
- IsMinimize(self) -> bool
- IsTopmost(self) -> bool
- Maximize(self, waitTime: float = 0.5) -> bool
- Set top level window maximize.
- Minimize(self, waitTime: float = 0.5) -> bool
- MoveToCenter(self) -> bool
- Move window to screen center.
- Restore(self, waitTime: float = 0.5) -> bool
- Restore window to normal state.
Similar to SwitchToThisWindow.
- SetActive(self, waitTime: float = 0.5) -> bool
- Set top level window active.
- SetTopmost(self, isTopmost: bool = True, waitTime: float = 0.5) -> bool
- Set top level window topmost.
isTopmost: bool.
waitTime: float.
- SwitchToThisWindow(self, waitTime: float = 0.5) -> None
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class TransformPattern(builtins.object) |
|
TransformPattern(pattern=None)
|
|
Methods defined here:
- Move(self, x: int, y: int, waitTime: float = 0.5) -> bool
- Call IUIAutomationTransformPattern::Move.
Move the UI Automation element.
x: int.
y: int.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-move
- Resize(self, width: int, height: int, waitTime: float = 0.5) -> bool
- Call IUIAutomationTransformPattern::Resize.
Resize the UI Automation element.
width: int.
height: int.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-resize
- Rotate(self, degrees: int, waitTime: float = 0.5) -> bool
- Call IUIAutomationTransformPattern::Rotate.
Rotates the UI Automation element.
degrees: int.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-rotate
- __init__(self, pattern=None)
- Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationtransformpattern
Readonly properties defined here:
- CanMove
- Property CanMove.
Call IUIAutomationTransformPattern::get_CurrentCanMove.
Return bool, indicates whether the element can be moved.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-get_currentcanmove
- CanResize
- Property CanResize.
Call IUIAutomationTransformPattern::get_CurrentCanResize.
Return bool, indicates whether the element can be resized.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-get_currentcanresize
- CanRotate
- Property CanRotate.
Call IUIAutomationTransformPattern::get_CurrentCanRotate.
Return bool, indicates whether the element can be rotated.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern-get_currentcanrotate
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class TransformPattern2(builtins.object) |
|
TransformPattern2(pattern=None)
|
|
Methods defined here:
- Zoom(self, zoomLevel: float, waitTime: float = 0.5) -> bool
- Call IUIAutomationTransformPattern2::Zoom.
Zoom the viewport of the control.
zoomLevel: float for int.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-zoom
- ZoomByUnit(self, zoomUnit: int, waitTime: float = 0.5) -> bool
- Call IUIAutomationTransformPattern2::ZoomByUnit.
Zoom the viewport of the control by the specified unit.
zoomUnit: int, a value in class `ZoomUnit`.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-zoombyunit
- __init__(self, pattern=None)
- Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationtransformpattern2
Readonly properties defined here:
- CanZoom
- Property CanZoom.
Call IUIAutomationTransformPattern2::get_CurrentCanZoom.
Return bool, indicates whether the control supports zooming of its viewport.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-get_CurrentCanZoom
- ZoomLevel
- Property ZoomLevel.
Call IUIAutomationTransformPattern2::get_CurrentZoomLevel.
Return float, the zoom level of the control's viewport.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-get_currentzoomlevel
- ZoomMaximum
- Property ZoomMaximum.
Call IUIAutomationTransformPattern2::get_CurrentZoomMaximum.
Return float, the maximum zoom level of the control's viewport.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-get_currentzoommaximum
- ZoomMinimum
- Property ZoomMinimum.
Call IUIAutomationTransformPattern2::get_CurrentZoomMinimum.
Return float, the minimum zoom level of the control's viewport.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationtransformpattern2-get_currentzoomminimum
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class TreeControl(Control) |
|
TreeControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- TreeControl
- Control
- builtins.object
Methods defined here:
- GetScrollPattern(self) -> uiautomation.ScrollPattern
- Return `ScrollPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionPattern(self) -> uiautomation.SelectionPattern
- Return `SelectionPattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class TreeItemControl(Control) |
|
TreeItemControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- TreeItemControl
- Control
- builtins.object
Methods defined here:
- GetExpandCollapsePattern(self) -> uiautomation.ExpandCollapsePattern
- Return `ExpandCollapsePattern` if it supports the pattern else None(Must support according to MSDN).
- GetInvokePattern(self) -> uiautomation.InvokePattern
- Return `InvokePattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetScrollItemPattern(self) -> uiautomation.ScrollItemPattern
- Return `ScrollItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetSelectionItemPattern(self) -> uiautomation.SelectionItemPattern
- Return `SelectionItemPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTogglePattern(self) -> uiautomation.TogglePattern
- Return `TogglePattern` if it supports the pattern else None(Conditional support according to MSDN).
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
|
class WindowControl(Control, TopLevel) |
|
WindowControl(searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, **searchProperties)
|
|
- Method resolution order:
- WindowControl
- Control
- TopLevel
- builtins.object
Methods defined here:
- GetDockPattern(self) -> uiautomation.DockPattern
- Return `DockPattern` if it supports the pattern else None(Conditional support according to MSDN).
- GetTransformPattern(self) -> uiautomation.TransformPattern
- Return `TransformPattern` if it supports the pattern else None(Must support according to MSDN).
- GetWindowPattern(self) -> uiautomation.WindowPattern
- Return `WindowPattern` if it supports the pattern else None(Must support according to MSDN).
- MetroClose(self, waitTime: float = 0.5) -> None
- Only work on Windows 8/8.1, if current window is Metro UI.
waitTime: float.
- __init__(self, searchFromControl: Optional[uiautomation.Control] = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 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/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement
Methods inherited from Control:
- AddSearchProperties(self, **searchProperties) -> None
- Add search properties using `dict.update`.
searchProperties: dict, same as searchProperties in `Control.__init__`.
- ButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ButtonControl'
- CalendarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CalendarControl'
- CaptureToImage(self, savePath: str, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> bool
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CheckBoxControl'
- Click(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ComboBoxControl'
- Control(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'Control'
- CustomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'CustomControl'
- DataGridControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataGridControl'
- DataItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DataItemControl'
- Disappears(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotDisappear: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Check if control disappears every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if control disappears.
- DocumentControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'DocumentControl'
- DoubleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- DragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- EditControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'EditControl'
- Exists(self, maxSearchSeconds: float = 5, searchIntervalSeconds: float = 0.5, printIfNotExist: bool = False) -> bool
- maxSearchSeconds: float
searchIntervalSeconds: float
Find control every searchIntervalSeconds seconds in maxSearchSeconds seconds.
Return bool, True if find
- GetAncestorControl(self, condition: Callable[[ForwardRef('Control'), int], bool]) -> Optional[ForwardRef('Control')]
- 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.
- GetCachedPattern(self, patternId: int, cache: bool)
- 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`.
- GetChildren(self) -> List[ForwardRef('Control')]
- Return List[Control], a list of `Control` subclasses.
- GetClickablePoint(self) -> Tuple[int, int, bool]
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getclickablepoint
- GetColorfulSearchPropertiesStr(self, keyColor='DarkGreen', valueColor='DarkCyan') -> str
- keyColor, valueColor: str, color name in class ConsoleColor
- GetFirstChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLastChildControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetLegacyIAccessiblePattern(self) -> uiautomation.LegacyIAccessiblePattern
- Return `LegacyIAccessiblePattern` if it supports the pattern else None.
- GetNextSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetParentControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPattern(self, patternId: int)
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpattern
- GetPatternAs(self, patternId: int, 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpatternas
- GetPixelColor(self, x: int, y: int) -> Optional[int]
- 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
- GetPosition(self, ratioX: float = 0.5, ratioY: float = 0.5) -> Optional[Tuple[int, int]]
- Gets the position of the center of the control.
ratioX: float.
ratioY: float.
Return Tuple[int, int], two ints tuple (x, y), the cursor positon relative to screen(0, 0)
- GetPreviousSiblingControl(self) -> Optional[ForwardRef('Control')]
- Return `Control` subclass or None.
- GetPropertyValue(self, propertyId: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalue
- GetPropertyValueEx(self, propertyId: int, ignoreDefaultValue: int) -> Any
- 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/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getcurrentpropertyvalueex
- GetRuntimeId(self) -> List[int]
- Call IUIAutomationElement::GetRuntimeId.
Return List[int], a list of int.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-getruntimeid
- GetSearchPropertiesStr(self) -> str
- GetSiblingControl(self, condition: Callable[[ForwardRef('Control')], bool], forward: bool = True) -> Optional[ForwardRef('Control')]
- 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.
- GetTopLevelControl(self) -> Optional[ForwardRef('Control')]
- 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.
- GetWindowText(self) -> Optional[str]
- Call native GetWindowText if control has a valid native handle.
- GroupControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'GroupControl'
- HeaderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderControl'
- HeaderItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HeaderItemControl'
- Hide(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Hide)`.
waitTime: float
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- HyperlinkControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'HyperlinkControl'
- ImageControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ImageControl'
- IsTopLevel(self) -> bool
- Determine whether current control is top level.
- ListControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListControl'
- ListItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ListItemControl'
- MenuBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuBarControl'
- MenuControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuControl'
- MenuItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'MenuItemControl'
- MiddleClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- MoveCursorToInnerPos(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveCursorToMyCenter(self, simulateMove: bool = True) -> Optional[Tuple[int, int]]
- 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.
- MoveWindow(self, x: int, y: int, width: int, height: int, repaint: bool = True) -> bool
- 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.
- PaneControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'PaneControl'
- ProgressBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ProgressBarControl'
- RadioButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'RadioButtonControl'
- Refind(self, maxSearchSeconds: float = 10, searchIntervalSeconds: float = 0.5, raiseException: bool = True) -> bool
- 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.
- RemoveSearchProperties(self, **searchProperties) -> None
- searchProperties: dict, same as searchProperties in `Control.__init__`.
- RightClick(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True, waitTime: float = 0.5) -> None
- 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.
- RightDragDrop(self, x1: int, y1: int, x2: int, y2: int, moveSpeed: float = 1, waitTime: float = 0.5) -> None
- ScrollBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ScrollBarControl'
- SemanticZoomControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SemanticZoomControl'
- SendKey(self, key: int, waitTime: float = 0.5) -> None
- 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.
- SendKeys(self, text: str, interval: float = 0.01, waitTime: float = 0.5, charMode: bool = True) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SeparatorControl'
- SetFocus(self) -> bool
- Call IUIAutomationElement::SetFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-setfocus
- SetSearchDepth(self, searchDepth: int) -> None
- SetSearchFromControl(self, searchFromControl: 'Control') -> None
- searchFromControl: `Control` or its subclass
- SetWindowText(self, text: str) -> bool
- Call native SetWindowText if control has a valid native handle.
- Show(self, waitTime: float = 0.5) -> Optional[bool]
- Call native `ShowWindow(SW.Show)`.
Return bool, True if succeed otherwise False and None if the handle could not be gotten.
- ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> Optional[bool]
- 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 and None if the handle could not be gotten.
- SliderControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SliderControl'
- SpinnerControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SpinnerControl'
- SplitButtonControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'SplitButtonControl'
- StatusBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'StatusBarControl'
- TabControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabControl'
- TabItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TabItemControl'
- TableControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TableControl'
- TextControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TextControl'
- ThumbControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ThumbControl'
- TitleBarControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TitleBarControl'
- ToBitmap(self, x: int = 0, y: int = 0, width: int = 0, height: int = 0) -> Optional[uiautomation.Bitmap]
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolBarControl'
- ToolTipControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'ToolTipControl'
- TreeControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeControl'
- TreeItemControl(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'TreeItemControl'
- WheelDown(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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.
- WheelUp(self, x: Optional[int] = None, y: Optional[int] = None, ratioX: float = 0.5, ratioY: float = 0.5, wheelTimes: int = 1, interval: float = 0.05, waitTime: float = 0.5) -> None
- 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(self, searchDepth=4294967295, searchInterval=0.5, foundIndex=1, element=0, **searchProperties) -> 'WindowControl'
- __getitem__(self, pos: int) -> Optional[ForwardRef('Control')]
- __str__(self) -> str
- Return str(self).
Static methods inherited from Control:
- CreateControlFromControl(control: 'Control') -> Optional[ForwardRef('Control')]
- 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.
- CreateControlFromElement(element) -> Optional[ForwardRef('Control')]
- 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.
Readonly properties inherited from Control:
- AcceleratorKey
- Property AcceleratorKey.
Call IUIAutomationElement::get_CurrentAcceleratorKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentacceleratorkey
- AccessKey
- Property AccessKey.
Call IUIAutomationElement::get_CurrentAccessKey.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentaccesskey
- AriaProperties
- Property AriaProperties.
Call IUIAutomationElement::get_CurrentAriaProperties.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariaproperties
- AriaRole
- Property AriaRole.
Call IUIAutomationElement::get_CurrentAriaRole.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentariarole
- AutomationId
- Property AutomationId.
Call IUIAutomationElement::get_CurrentAutomationId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentautomationid
- BoundingRectangle
- Property BoundingRectangle.
Call IUIAutomationElement::get_CurrentBoundingRectangle.
Return `Rect`.
Refer https://docs.microsoft.com/en-us/windows/win32/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())
- ClassName
- Property ClassName.
Call IUIAutomationElement::get_CurrentClassName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentclassname
- ControlType
- Property ControlType.
Return int, a value in class `ControlType`.
Call IUIAutomationElement::get_CurrentControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentcontroltype
- ControlTypeName
- Property ControlTypeName.
- Culture
- Property Culture.
Call IUIAutomationElement::get_CurrentCulture.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentculture
- Element
- Property Element.
Return `ctypes.POINTER(IUIAutomationElement)`.
- FrameworkId
- Property FrameworkId.
Call IUIAutomationElement::get_CurrentFrameworkId.
Return str, such as Win32, WPF...
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentframeworkid
- HasKeyboardFocus
- Property HasKeyboardFocus.
Call IUIAutomationElement::get_CurrentHasKeyboardFocus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthaskeyboardfocus
- HelpText
- Property HelpText.
Call IUIAutomationElement::get_CurrentHelpText.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currenthelptext
- IsContentElement
- Property IsContentElement.
Call IUIAutomationElement::get_CurrentIsContentElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontentelement
- IsControlElement
- Property IsControlElement.
Call IUIAutomationElement::get_CurrentIsControlElement.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiscontrolelement
- IsDataValidForForm
- Property IsDataValidForForm.
Call IUIAutomationElement::get_CurrentIsDataValidForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisdatavalidforform
- IsEnabled
- Property IsEnabled.
Call IUIAutomationElement::get_CurrentIsEnabled.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisenabled
- IsKeyboardFocusable
- Property IsKeyboardFocusable.
Call IUIAutomationElement::get_CurrentIsKeyboardFocusable.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentiskeyboardfocusable
- IsOffscreen
- Property IsOffscreen.
Call IUIAutomationElement::get_CurrentIsOffscreen.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisoffscreen
- IsPassword
- Property IsPassword.
Call IUIAutomationElement::get_CurrentIsPassword.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentispassword
- IsRequiredForForm
- Property IsRequiredForForm.
Call IUIAutomationElement::get_CurrentIsRequiredForForm.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentisrequiredforform
- ItemStatus
- Property ItemStatus.
Call IUIAutomationElement::get_CurrentItemStatus.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemstatus
- ItemType
- Property ItemType.
Call IUIAutomationElement::get_CurrentItemType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentitemtype
- LocalizedControlType
- Property LocalizedControlType.
Call IUIAutomationElement::get_CurrentLocalizedControlType.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentlocalizedcontroltype
- Name
- Property Name.
Call IUIAutomationElement::get_CurrentName.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentname
- NativeWindowHandle
- Property NativeWindowHandle.
Call IUIAutomationElement::get_CurrentNativeWindowHandle.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentnativewindowhandle
- Orientation
- Property Orientation.
Return int, a value in class `OrientationType`.
Call IUIAutomationElement::get_CurrentOrientation.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentorientation
- ProcessId
- Property ProcessId.
Call IUIAutomationElement::get_CurrentProcessId.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentprocessid
- ProviderDescription
- Property ProviderDescription.
Call IUIAutomationElement::get_CurrentProviderDescription.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelement-get_currentproviderdescription
Data descriptors inherited from Control:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from Control:
- ValidKeys = {'AutomationId', 'ClassName', 'Compare', 'ControlType', 'Depth', 'Name', ...}
Methods inherited from TopLevel:
- IsMaximize(self) -> bool
- IsMinimize(self) -> bool
- IsTopmost(self) -> bool
- Maximize(self, waitTime: float = 0.5) -> bool
- Set top level window maximize.
- Minimize(self, waitTime: float = 0.5) -> bool
- MoveToCenter(self) -> bool
- Move window to screen center.
- Restore(self, waitTime: float = 0.5) -> bool
- Restore window to normal state.
Similar to SwitchToThisWindow.
- SetActive(self, waitTime: float = 0.5) -> bool
- Set top level window active.
- SetTopmost(self, isTopmost: bool = True, waitTime: float = 0.5) -> bool
- Set top level window topmost.
isTopmost: bool.
waitTime: float.
- SwitchToThisWindow(self, waitTime: float = 0.5) -> None
|
class WindowPattern(builtins.object) |
|
WindowPattern(pattern=None)
|
|
Methods defined here:
- Close(self, waitTime: float = 0.5) -> bool
- Call IUIAutomationWindowPattern::Close.
Close the window.
waitTime: float.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-close
- SetWindowVisualState(self, state: int, waitTime: float = 0.5) -> bool
- Call IUIAutomationWindowPattern::SetWindowVisualState.
Minimize, maximize, or restore the window.
state: int, a value in class `WindowVisualState`.
waitTime: float.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-setwindowvisualstate
- WaitForInputIdle(self, milliseconds: int) -> bool
- Call IUIAutomationWindowPattern::WaitForInputIdle.
Cause the calling code to block for the specified time or
until the associated process enters an idle state, whichever completes first.
milliseconds: int.
Return bool, True if succeed otherwise False.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-waitforinputidle
- __init__(self, pattern=None)
- Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nn-uiautomationclient-iuiautomationwindowpattern
Readonly properties defined here:
- CanMaximize
- Property CanMaximize.
Call IUIAutomationWindowPattern::get_CurrentCanMaximize.
Return bool, indicates whether the window can be maximized.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-get_currentcanmaximize
- CanMinimize
- Property CanMinimize.
Call IUIAutomationWindowPattern::get_CurrentCanMinimize.
Return bool, indicates whether the window can be minimized.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-get_currentcanminimize
- IsModal
- Property IsModal.
Call IUIAutomationWindowPattern::get_CurrentIsModal.
Return bool, indicates whether the window is modal.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-get_currentismodal
- IsTopmost
- Property IsTopmost.
Call IUIAutomationWindowPattern::get_CurrentIsTopmost.
Return bool, indicates whether the window is the topmost element in the z-order.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-get_currentistopmost
- WindowInteractionState
- Property WindowInteractionState.
Call IUIAutomationWindowPattern::get_CurrentWindowInteractionState.
Return int, a value in class `WindowInteractionState`,
the current state of the window for the purposes of user interaction.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-get_currentwindowinteractionstate
- WindowVisualState
- Property WindowVisualState.
Call IUIAutomationWindowPattern::get_CurrentWindowVisualState.
Return int, a value in class `WindowVisualState`,
the visual state of the window; that is, whether it is in the normal, maximized, or minimized state.
Refer https://docs.microsoft.com/en-us/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationwindowpattern-get_currentwindowvisualstate
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
|