2.关于 uiautomation.uiautomation 模块中 ListControl (列表控件)类的帮助信息

class ListControl(Control)类。列表控件(控件)
| ListControl(searchFromControl: uiautomation.uiautomation.Control = None,
列表控件(从控件搜索:UI自动化。UI自动化。控件=空值
searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1,
搜索深度:整数 = 4294967295,搜索间隔:浮点数 = 0.5,找到的索引:整数=1,
element=None, **searchProperties)
**元素节点 = 空值,搜索属性)
|
| Method resolution order:方法解析顺序
| ListControl 列表控件
| Control 列表
| builtins.object 内置对象
|
| Methods defined here: 在这里定义的方法
|
| GetGridPattern(self) -> uiautomation.uiautomation.GridPattern
获取网格模式(参数)->UI自动化。UI自动化。网格模式
| Return GridPattern if it supports the pattern else None(Conditional support
回程 网格模式 如果(某个对象)支持这种模式,则返回该模式相关的内容或对象;如果不支持,则返回 None
according to MSDN).(根据MSDN的条件支持)

|
| GetMultipleViewPattern(self) -> uiautomation.uiautomation.MultipleViewPattern
| Return MultipleViewPattern if it supports the pattern else None(Conditional support according to MSDN).
获取多视图模式(参数)-> UI自动化。UI自动化。多视图模式
检查某个对象是否支持 MultipleViewPattern(多视图模式),如果支持,则返回与该模式相关的对象;如果不支持(基于Microsoft Developer Network文档中所述的条件支持原则),则返回None

|
| GetScrollPattern(self) -> uiautomation.uiautomation.ScrollPattern
| Return ScrollPattern if it supports the pattern else None(Conditional support according to MSDN).
获取滚动模式(方法)(当调用时) -> 返回UIAutomation库中的ScrollPattern对象
检查某个UI元素是否支持滚动模式。如果该元素确实支持 ScrollPattern(即具有滚动功能),则方法会返回一个与该滚动模式相关的对象;若不支持,则根据Microsoft Developer Network文档中的条件支持说明,该方法将返回None值。

|
| GetSelectionPattern(self) -> uiautomation.uiautomation.SelectionPattern
| Return SelectionPattern if it supports the pattern else None(Conditional support according to MSDN).
获取选择模式(方法)(当调用时) -> 返回UIAutomation库中的SelectionPattern对象。
如果支持该模式则返回 SelectionPattern,否则(基于MSDN中所述的条件支持原则)返回 None。

|
| init(self, searchFromControl: uiautomation.uiautomation.Control = None, searchDepth: int = 4294967295, searchInterval: float = 0.5, foundIndex: int = 1, element=None, *searchProperties)
初始化(参数,搜索起始点的UI元素:UI自动化.UI自动化.控件 = 空值,搜索深度:整数 = 4294967295, 延时等待或定时搜索:浮点数 = 0.5,指定找到匹配条件的第几个元素:整数 = 1, 用于直接指定要操作的对象 = 空值, 用于搜索UI元素的一系列属性及其对应的值。)

| searchFromControl: Control or its subclass, if it is None, search from root control(Desktop).
参数 searchFromControl 需要传入一个 Control 类型的对象或者它的某个子类对象。当这个参数被设置为 None 时,搜索将从根控件,即桌面(Desktop)开始进行
| searchDepth: int, max search depth from searchFromControl.
参数 searchDepth 是一个整数值类型,它定义了在执行搜索时,从 searchFromControl 指定的控件开始向下遍历 UI 元素树的最大层级。
| foundIndex: int, starts with 1, >= 1.
参数 foundIndex 是一个整数,它的初始值应该是1,并且要求其值至少为1。这个参数可能用于指定在搜索过程中找到并返回第几个匹配条件的元素。
| searchInterval: float, wait searchInterval after every search in self.Refind and self.Exists, the global timeout is TIME_OUT_SECOND.
参数 searchInterval 是一个浮点数,它表示在调用 self.Refind 或 self.Exists 这两个方法进行搜索操作时,每执行一次搜索之后会暂停等待 searchInterval 指定的秒数。同时指出整个搜索过程有一个全局的超时时间,该超时时间为 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: int = None, y: 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: int = None, y: 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]) -> ‘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) -> ‘Control’
| Return Control subclass or None.
|
| GetLastChildControl(self) -> ‘Control’
| Return Control subclass or None.
|
| GetLegacyIAccessiblePattern(self) -> uiautomation.uiautomation.LegacyIAccessiblePattern
| Return LegacyIAccessiblePattern if it supports the pattern else None.
|
| GetNextSiblingControl(self) -> ‘Control’
| Return Control subclass or None.
|
| GetParentControl(self) -> ‘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) -> 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) -> 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) -> ‘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) -> ‘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) -> ‘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) -> 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) -> bool
| Call native ShowWindow(SW.Hide).
| waitTime: float
| Return bool, True if succeed otherwise False.
|
| 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: int = None, y: 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: int = None, y: int = None, ratioX: float = 0.5, ratioY: float = 0.5, simulateMove: bool = True) -> 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) -> 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: int = None, y: 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) -> bool
| Call native ShowWindow(SW.Show).
| Return bool, True if succeed otherwise False.
|
| ShowWindow(self, cmdShow: int, waitTime: float = 0.5) -> 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.
|
| 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) -> uiautomation.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: int = None, y: 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: int = None, y: 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’
|
| str(self) -> str
| Return str(self).
|
| ----------------------------------------------------------------------
| Static methods inherited from Control:
|
| CreateControlFromControl(control: ‘Control’) -> ‘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) -> ‘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 (if defined)
|
| weakref
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from Control:
|
| ValidKeys = {‘AutomationId’, ‘ClassName’, ‘Compare’, ‘ControlType’, 'D…

  • 19
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
根据UIAutomation封装了很多自定义方法 现在只需要实例化之后 直接调用方法即可完成。比如单击某个按钮,现在只需要直接调用ClickElement,非常实用。 ClickElement 单击指定的自动化元素 DisselectAllDataGridRow 不选所有行 DisselectDataGridRow 不选特定的某一行 FocusWindow 获取窗口焦点 GetAllElement 获取指定父自动化元素下的所有激活的控件 GetAllElementDetails 获取指定自动化元素下的详细信息包括AutomationID,ControlType以及Name GetAllMenus 获取所有菜单项 GetAllSubMenus 获取某个菜单下的所有子菜单项 GetColumnsFromGridLine 获取指定行的所有列 GetColumnValuesFromGridLine 获取行的每一列数据 GetControlType(AutomationElement) 获取制动自动化元素的控件型 GetControlType(TypeOfControl) 获取UIAutomation控件型 GetDocumentText 获取document控件的值 GetElementByID 获取父自动化元素下指定元素控件ID的引用 GetElementByName 获取父自动化元素下的指定子元素的引用 GetElementsByControlType 获取父自动化元素下的特定型的所有自动化元素 GetGridLinesFromDataGrid 获取网格控件的全部行元素的引用 GetHeaderFromDataGrid 获取指定网格控件的标题栏引用 GetMenuBar 获取菜单栏控件 GetMenuByName 通过特定的名称去获取菜单UI自动化元素 GetName 获取指定自动化元素的名称 GetSubMenuByName 获取主菜单下的指定子菜单项的引用 GetValue 获取指定自动化元素的值 GetWindowByName(String) 获取desktop下的指定窗口名称的子UI自动化元素 GetWindowByName(String, AutomationElement) 获取特定父UI自动化元素下的制定窗口名称的子UI自动化元素 GetWindowList() 获取当前桌面根下所有的UI自动化元素下 GetWindowList(AutomationElement) 获取特定父UI自动化元素下的所有窗口的名称 RefindMainApplication 重新获取desktop下的指定窗口的自动化元素引用 SelectAllDataGridRow 选所有行 SelectDataGridRow(AutomationElement) 选特定的某一行 SelectDataGridRow(AutomationElement, Boolean) 将特定的DateGridRow加入选 SelectValueInComboBox 从下拉框指定值的项 SelectValueInListBox 从列表指定值的项 SetValue 给予指定自动化元素赋值 以上的方法还不是很完善 正在完善。如果有什么意见和建议,请发送邮件获取 [email protected] 如果你看了这个帮助文件之后觉得有用的,请发邮件获取,我将把dll文件给你。谢谢。
uiautomation是一个用于自动化Windows应用程序的Python模块,它封装了微软UIAutomation API,并提供了一些方便的方法和功能。你可以在GitHub上找到该项目的地址,其包含了详细的文档和示例代码。 要使用uiautomation,首先需要安装Python 3,并安装comtypes和typing这两个依赖包。请注意,避免使用Python 3.7.6和3.8.1这两个版本,因为在这些版本comtypes无法正常工作。 在使用uiautomation时,你可以使用它提供的日志输出将日志同时输出到控制台和文件。此外,uiautomation还提供了延迟搜索控件的功能。当创建一个Control对象时,uiautomation不会立即开始搜索控件,而是在使用该对象的属性或方法时才开始搜索。如果在设定的时间内找不到控件uiautomation会抛出一个LookupError异常。 对于初学者来说,入门uiautomation可以先阅读它的文档并浏览GitHub上的示例代码,以了解如何使用uiautomation来自动化Windows应用程序的各种操作。随着进一步的学习和实践,你可以掌握更多高级的用法和技巧,以实现更复杂的自动化任务。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [Windows桌面程序自动化控制之uiautomation模块全面讲解](https://blog.csdn.net/zhangliang0000/article/details/129027669)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

天涯海角觅知音

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值