💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# pywinauto.controls.uiawrapper UI自动化元素的基本包装 [TOC] ## *class* `pywinauto.controls.uiawrapper.LazyProperty`(*fget*) Bases: `object` 对对象属性的延迟计算。 属性应表示不可变的数据,因为它将替换自身。由提供: [http://stackoverflow.com/a/6849299/1260742](http://stackoverflow.com/a/6849299/1260742) ## *class* `pywinauto.controls.uiawrapper.UIAWrapper`(*element\_info*) Bases: [`pywinauto.base_wrapper.BaseWrapper`](pywinauto.base_wrapper.md) 用户界面自动化(UIA)控件的默认包装器。 所有其他UIA包装都源于此。 此类包含许多基础UIA功能的功能,以便与Windows一起使用。 大多数方法适用于每种元素类型。 例如,您可以在任何元素上click()。 ### `automation_id`() 返回控件的自动化ID ### `can_select_multiple`() SelectionProvider模式的CanSelectMultiple接口 指示UI自动化提供程序是否允许同时选择多个子元素。 ### `children_texts`() 获取控件子级的文本 ### `close`() 关闭窗口 只有支持Window模式的控件才能回答。 如果没有(菜单阴影,工具提示......),请尝试发送“Esc”键 ### `collapse`() 显示控件的所有子节点,控件或内容 ExpandCollapse控件模式的Collapse方法的接口。 ### `expand`() 显示控件的所有子节点,控件或内容 ExpandCollapse控件模式的Expand方法的接口。 ### `friendly_class_name`() 返回控件的友好类名 在某些情况下,这与控制类不同。 class_name()是控件的实际“已注册”窗口类,而friendly_class_name()希望是对用户更有意义的东西。 例如,Checkbox实现为Buttons - 因此CheckBox的类是“Button” - 但友好的类是“CheckBox” ### `get_expand_state`() 指示控件的状态:展开或折叠。 An interface to CurrentExpandCollapseState property of the ExpandCollapse control pattern. Values for enumeration as defined in uia\_defines module: expand\_state\_collapsed = 0 expand\_state\_expanded = 1 expand\_state\_partially = 2 expand\_state\_leaf\_node = 3 > > `get_selection`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.get_selection "Permalink to this definition") > > An interface to GetSelection of the SelectionProvider pattern > > Retrieves a UI Automation provider for each child element that is selected. Builds a list of UIAElementInfo elements from all retrieved providers. > > `get_show_state`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.get_show_state "Permalink to this definition") > > Get the show state and Maximized/minimzed/restored state > > Returns values as following > > window\_visual\_state\_normal = 0 window\_visual\_state\_maximized = 1 window\_visual\_state\_minimized = 2 > > `has_keyboard_focus`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.has_keyboard_focus "Permalink to this definition") > > Return True if the element is focused with keyboard > > `iface_expand_collapse` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_expand_collapse "Permalink to this definition") > > `iface_grid` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_grid "Permalink to this definition") > > `iface_grid_item` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_grid_item "Permalink to this definition") > > `iface_invoke` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_invoke "Permalink to this definition") > > `iface_item_container` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_item_container "Permalink to this definition") > > `iface_range_value` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_range_value "Permalink to this definition") > > `iface_scroll` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_scroll "Permalink to this definition") > > `iface_scroll_item` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_scroll_item "Permalink to this definition") > > `iface_selection` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_selection "Permalink to this definition") > > `iface_selection_item` *= None* > > `iface_table` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_table "Permalink to this definition") > > `iface_table_item` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_table_item "Permalink to this definition") > > `iface_text` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_text "Permalink to this definition") > > `iface_toggle` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_toggle "Permalink to this definition") > > `iface_transform` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_transform "Permalink to this definition") > > `iface_transformV2` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_transformV2 "Permalink to this definition") > > `iface_value` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_value "Permalink to this definition") > > `iface_virtualized_item` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_virtualized_item "Permalink to this definition") > > `iface_window` *= None*[¶](#pywinauto.controls.uiawrapper.UIAWrapper.iface_window "Permalink to this definition") > > `invoke`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.invoke "Permalink to this definition") > > An interface to the Invoke method of the Invoke control pattern > > `is_active`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.is_active "Permalink to this definition") > > Whether the window is active or not > > `is_collapsed`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.is_collapsed "Permalink to this definition") > > Test if the control is collapsed > > `is_dialog`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.is_dialog "Permalink to this definition") > > Return true if the control is a dialog window (WindowPattern interface is available) > > `is_expanded`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.is_expanded "Permalink to this definition") > > Test if the control is expanded > > `is_keyboard_focusable`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.is_keyboard_focusable "Permalink to this definition") > > Return True if the element can be focused with keyboard > > `is_maximized`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.is_maximized "Permalink to this definition") > > Indicate whether the window is maximized or not > > `is_minimized`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.is_minimized "Permalink to this definition") > > Indicate whether the window is minimized or not > > `is_normal`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.is_normal "Permalink to this definition") > > Indicate whether the window is normal (i.e. not minimized and not maximized) > > `is_selected`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.is_selected "Permalink to this definition") > > Indicate that the item is selected or not. > > Only items supporting SelectionItem pattern should answer. Raise NoPatternInterfaceError if the pattern is not supported > > Usually applied for controls like: a radio button, a tree view item, a list item. > > `is_selection_required`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.is_selection_required "Permalink to this definition") > > An interface to IsSelectionRequired property of the SelectionProvider pattern. > > This property can be dynamic. For example, the initial state of a control might not have any items selected by default, meaning that IsSelectionRequired is FALSE. However, after an item is selected the control must always have at least one item selected. > > `legacy_properties`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.legacy_properties "Permalink to this definition") > > Get the element’s LegacyIAccessible control pattern interface properties > > `maximize`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.maximize "Permalink to this definition") > > Maximize the window > > Only controls supporting Window pattern should answer > > `menu_select`(*path*, *exact=False*)[¶](#pywinauto.controls.uiawrapper.UIAWrapper.menu_select "Permalink to this definition") > > Select a menu item specified in the path > > The full path syntax is specified in: `pywinauto.menuwrapper.Menu.get_menu_path()` > > There are usually at least two menu bars: “System” and “Application” System menu bar is a standard window menu with items like: ‘Restore’, ‘Move’, ‘Size’, ‘Minimize’, e.t.c. This menu bar usually has a “Title Bar” control as a parent. Application menu bar is often what we look for. In most cases, its parent is the dialog itself so it should be found among the direct children of the dialog. Notice that we don’t use “Application” string as a title criteria because it couldn’t work on applications with a non-english localization. If there is no menu bar has been found we fall back to look up for Menu control. We try to find the control through all descendants of the dialog > > `minimize`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.minimize "Permalink to this definition") > > Minimize the window > > Only controls supporting Window pattern should answer > > `restore`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.restore "Permalink to this definition") > > Restore the window to normal size > > Only controls supporting Window pattern should answer > > `scroll`(*direction*, *amount*, *count=1*, *retry\_interval=0.1*)[¶](#pywinauto.controls.uiawrapper.UIAWrapper.scroll "Permalink to this definition") > > Ask the control to scroll itself > > **direction** can be any of “up”, “down”, “left”, “right” **amount** can be only “line” or “page” **count** (optional) the number of times to scroll **retry\_interval** (optional) interval between scroll actions > > `select`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.select "Permalink to this definition") > > Select the item > > Only items supporting SelectionItem pattern should answer. Raise NoPatternInterfaceError if the pattern is not supported > > Usually applied for controls like: a radio button, a tree view item or a list item. > > `selected_item_index`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.selected_item_index "Permalink to this definition") > > Return the index of a selected item > > `set_focus`()[¶](#pywinauto.controls.uiawrapper.UIAWrapper.set_focus "Permalink to this definition") > > Set the focus to this element > > `writable_props`[¶](#pywinauto.controls.uiawrapper.UIAWrapper.writable_props "Permalink to this definition") > > Extend default properties list. > ## *class* `pywinauto.controls.uiawrapper.UiaMeta(name, bases, attrs)` > > Bases: [`pywinauto.base_wrapper.BaseMeta`](pywinauto.base_wrapper.html#pywinauto.base_wrapper.BaseMeta "pywinauto.base_wrapper.BaseMeta") > > Metaclass for UiaWrapper objects > > *static* `find_wrapper`(*element*)[¶](#pywinauto.controls.uiawrapper.UiaMeta.find_wrapper "Permalink to this definition") > > Find the correct wrapper for this UIA element > > `pywinauto.controls.uiawrapper.``lazy_property`[¶](#pywinauto.controls.uiawrapper.lazy_property "Permalink to this definition") > > alias of [`LazyProperty`](#pywinauto.controls.uiawrapper.LazyProperty "pywinauto.controls.uiawrapper.LazyProperty")