pywinauto.controls.uia_controls¶
Wrap various UIA windows controls
- class
pywinauto.controls.uia_controls.ButtonWrapper(elem)¶Wrap a UIA-compatible Button, CheckBox or RadioButton control
click()¶Click the Button control by using Invoke pattern
get_toggle_state()¶Get a toggle state of a check box control.
The toggle state is represented by an integer 0 - unchecked 1 - checked 2 - indeterminate
The following constants are defined in the uia_defines module toggle_state_off = 0 toggle_state_on = 1 toggle_state_inderteminate = 2
is_dialog()¶Buttons are never dialogs so return False
is_selected()¶An interface to CurrentIsSelected method of the SelectionItem control pattern.
Usually applied for a radio button control
select()¶An interface to Select method of the SelectionItem control pattern.
Usually applied for a radio button control
toggle()¶An interface to Toggle method of the Toggle control pattern.
Control supporting the Toggle pattern cycles through its toggle states in the following order: ToggleState_On, ToggleState_Off and, if supported, ToggleState_Indeterminate
Usually applied for the check box control.
The radio button control does not implement IToggleProvider, because it is not capable of cycling through its valid states. Toggle a state of a check box control. (Use ‘select’ method instead) Notice, a radio button control isn’t supported by UIA. https://msdn.microsoft.com/en-us/library/windows/desktop/ee671290(v=vs.85).aspx
- class
pywinauto.controls.uia_controls.ComboBoxWrapper(elem)¶Wrap a UIA CoboBox control
item_count()¶Return the number of items in the combobox
The interface is kept mostly for a backward compatibility with the native ComboBox interface
select(item)¶Select the ComboBox item
The item can be either a 0 based index of the item to select or it can be the string that you want to select
selected_index()¶Return the selected index
selected_text()¶Return the selected text or None
Notice, that in case of multi-select it will be only the text from a first selected item
texts()¶Return the text of the items in the combobox
- class
pywinauto.controls.uia_controls.EditWrapper(elem)¶Wrap an UIA-compatible Edit control
get_line(line_index)¶Return the line specified
has_title= False¶
line_count()¶Return how many lines there are in the Edit
line_length(line_index)¶Return how many characters there are in the line
select(start=0, end=None)¶Set the edit selection of the edit control
selection_indices()¶The start and end indices of the current selection
set_edit_text(text, pos_start=None, pos_end=None)¶Set the text of the edit control
set_text(text, pos_start=None, pos_end=None)¶Set the text of the edit control
set_window_text(text, append=False)¶Override set_window_text for edit controls because it should not be used for Edit controls.
Edit Controls should either use set_edit_text() or type_keys() to modify the contents of the edit control.
text_block()¶Get the text of the edit control
texts()¶Get the text of the edit control
writable_props¶Extend default properties list.
- class
pywinauto.controls.uia_controls.HeaderWrapper(elem)¶Wrap an UIA-compatible Header control
- class
pywinauto.controls.uia_controls.ListItemWrapper(elem, container=None)¶Wrap an UIA-compatible ListViewItem control
is_checked()¶Return True if the ListItem is checked
Only items supporting Toggle pattern should answer. Raise NoPatternInterfaceError if the pattern is not supported
is_selected()¶Return True if the ListItem is selected
select()¶Select/Deselect all cells in the ListItem
texts()¶Return a list of item texts
- class
pywinauto.controls.uia_controls.ListViewWrapper(elem)¶Wrap an UIA-compatible ListView control
cell(row, column)¶Return a cell in the ListView control
Only for controls with Grid pattern support
- row is an index of a row in the list.
- column is an index of a column in the specified row.
The returned cell can be of different control types. Mostly: TextBlock, ImageControl, EditControl, DataItem or even another layer of data items (Group, DataGrid)
column_count()¶Return the number of columns
columns()¶Get the information on the columns of the ListView
get_column(col_index)¶Get the information for a column of the ListView
get_header_control()¶Return the Header control associated with the ListView
get_item(row)¶Return an item of the ListView control
- row Can be either an index of the row or a string with the text of a cell in the row you want returned.
get_item_rect(item_index)¶Return the bounding rectangle of the list view item
The interface is kept mostly for a backward compatibility with the native ListViewWrapper interface
get_items()¶Return all items of the ListView control
get_selected_count()¶Return a number of selected items
The call can be quite expensieve as we retrieve all the selected items in order to count them
item(row)¶Return an item of the ListView control
- row Can be either an index of the row or a string with the text of a cell in the row you want returned.
item_count()¶A number of items in the ListView
items()¶Return all items of the ListView control
texts()¶Return a list of item texts
writable_props¶Extend default properties list.
- class
pywinauto.controls.uia_controls.MenuItemWrapper(elem)¶Wrap an UIA-compatible MenuItem control
items()¶Find all items of the menu item
select()¶Apply Select pattern
- class
pywinauto.controls.uia_controls.MenuWrapper(elem)¶Wrap an UIA-compatible MenuBar or Menu control
item_by_index(idx)¶Find a menu item specified by the index
item_by_path(path, exact=False)¶Find a menu item specified by the path
The full path syntax is specified in:
controls.menuwrapper.Menu.get_menu_path()Note: $ - specifier is not supported
items()¶Find all menu items
- class
pywinauto.controls.uia_controls.SliderWrapper(elem)¶Wrap an UIA-compatible Slider control
has_title= False¶
large_change()¶Get large change of slider’s thumb
This change is achieved by pressing PgUp and PgDown keys when slider’s thumb has keyboard focus.
max_value()¶Get maximum value of the Slider
min_value()¶Get minimum value of the Slider
set_value(value)¶Set position of slider’s thumb
small_change()¶Get small change of slider’s thumb
This change is achieved by pressing left and right arrows when slider’s thumb has keyboard focus.
value()¶Get current position of slider’s thumb
- class
pywinauto.controls.uia_controls.TabControlWrapper(elem)¶Wrap an UIA-compatible Tab control
get_selected_tab()¶Return the index of a selected tab
select(item)¶Select a tab by index or by name
tab_count()¶Return a number of tabs
texts()¶Tabs texts
- class
pywinauto.controls.uia_controls.ToolbarWrapper(elem)¶Wrap an UIA-compatible ToolBar control
The control’s children usually are: Buttons, SplitButton, MenuItems, ThumbControls, TextControls, Separators, CheckBoxes. Notice that ToolTip controls are children of the top window and not of the toolbar.
Return the button by the specified identifier
button_identifier can be either an index of a button or a string with the text of the button.
- exact flag specifies if the exact match for the text look up
has to be applied.
Return a number of buttons on the ToolBar
Find where the button is and toggle it
button_identifier can be either an index of a button or a string with the text of the button.
make_checked specifies the required toggled state of the button. If the button is already in the specified state the state isn’t changed.
- exact flag specifies if the exact match for the text look up
has to be applied
texts()¶Return texts of the Toolbar
writable_props¶Extend default properties list.
- class
pywinauto.controls.uia_controls.TooltipWrapper(elem)¶Wrap an UIA-compatible Tooltip control