Window
activate
activate()
Description
Activates the window and brings it to the foreground.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.activate()maximize
maximize()
Description
Maximizes the window.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.maximize()minimize
minimize()
Description
Minimizes the window.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.minimize()hide
hide()
Description
Hides the window.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.hide()show
show()
Description
Shows the window.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.show()wait_disappear
wait_disappear(timeout=30)
Description
Waits for the window to disappear.
Parameters
timeout<int> The maximum time in seconds to wait for the window to disappear.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.wait_disappear()close
close()
Description
Closes the window.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.close()get_element_by_name
get_element_by_name(element, index=1, parent_element=None, timeout=10)
Description
Gets a control by its name.
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The timeout in seconds to wait for the control to appear.
Return value
The control object.<Element>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
ele = wnd.get_element_by_name("Notepad input box")count
count(element, parent_element=None)
Description
Counts the number of controls that match the specified name.
Parameters
element<str> The name of the control.
parent_element<Element> The parent control.
Return value
The number of matching controls.<int>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
ele_count = wnd.count("Notepad input box")wait_loaded
wait_loaded(element, index=1, parent_element=None, timeout=10)
Description
Waits for a control to load.
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control to load, in seconds.
Return value
Returns True if the control loads successfully, or False if the timeout is reached.<bool>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.wait_loaded("Notepad input box")input_text
input_text(element, value, index=1, parent_element=None, simulate=False, replace=True, send_window_message=True, sent_raw=False, wait_mili_seconds=20, timeout=10)
Description
Inputs text into a control.
Parameters
element<str> The name of the control.
value<str> The text to input.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
simulate<bool> Specifies whether to simulate user input.
replace<bool> If True, clears the control's existing content before inputting new text.
send_window_message<bool> Specifies whether to send Windows messages. This parameter applies only when simulate is False.
sent_raw<bool> Specifies whether to send raw keystrokes. This parameter applies only when simulate is False.
wait_mili_seconds<int> The delay in milliseconds between keystrokes. This applies only to simulated input. Default: 20. Maximum: 100. A large value may cause a timeout.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.input_text("Notepad input box", "This is a test")input_hotkeys
input_hotkeys(element, value, replace=False, index=1, parent_element=None, timeout=10)
Description
Inputs a hotkey or key combination into a control. For details, see input_hotkey Usage and virtual-key code List.
Parameters
element<str> The name of the control.
value<str> The virtual-key code.
replace<bool> Specifies whether to clear existing content.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.input_hotkeys("Notepad input box", "VK_BACK")drive_input
drive_input(element, value, replace=True, index=1, parent_element=None, wait_mili_seconds=20, timeout=10)
Description
Simulates keyboard input in a control using a driver.
For usage limitations, see Driver Input Restrictions.
Parameters
element<str> The name of the control.
value<str> The text to input.
replace<bool> Specifies whether to clear existing content before inputting new text.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
wait_mili_seconds<int> The delay in milliseconds between keystrokes. This applies only to simulated input. Default: 20. Maximum: 100. A large value may cause a timeout.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.drive_input("Notepad input box", "RpaTest")click
click(element, button='left', simulate=True, offset_x=0, offset_y=0, index=1, parent_element=None, timeout=10)
Description
Clicks a control, by default at its center. You can use the offset parameters to click a different position.
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
simulate<bool> Specifies whether to simulate the click.
offset_x<int> The horizontal offset in pixels from the control's center.
offset_y<int> The vertical offset in pixels from the control's center.
button<str> The mouse button to use for the click.
Available options:
left: The left mouse button.right: The right mouse button.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.click("Notepad input box")double_click
double_click(element, offset_x=0, offset_y=0, index=1, parent_element=None, simulate=True, timeout=10)
Description
Double-clicks a control, by default at its center. You can use the offset parameters to double-click a different position.
Parameters
element<str> The name of the control.
offset_x<int> The horizontal offset in pixels from the control's center.
offset_y<int> The vertical offset in pixels from the control's center.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
simulate<bool> Specifies whether to simulate the double-click.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.double_click("Notepad input box")expand
expand(element, index=1, parent_element=None, timeout=10)
Description
Expands a node in a control, such as a tree view item.
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.expand("Control Name")collapse
collapse(element, index=1, parent_element=None, timeout=10)
Description
Collapses a node in a control, such as a tree view item.
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.collapse("Control Name")set_selected_item_by_text
set_selected_item_by_text(element, text, index=1, parent_element=None, timeout=10)
Description
Selects an item in a combobox or drop-down list by its display text.
Parameters
element<str> The name of the control.
text<str> The display text of the item to select.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.set_selected_item_by_text("Control Name", "Item to select")set_selected_item_by_index
set_selected_item_by_index(element, item_index, index=1, parent_element=None, timeout=10)
Description
Selects an item in a combobox or drop-down list by its index.
Parameters
element<str> The name of the control.
item_index<int> The index of the item to select.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.set_selected_item_by_index("Control Name", 0)get_selected_items
get_selected_items(element, mode='selected', index=1, parent_element=None, timeout=10)
Description
Gets all items or only the selected items from a combobox.
Parameters
element<str> The name of the control.
mode<str> The selection mode.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Return value
A list of item texts.<list>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
selected_items = wnd.get_selected_items("Control Name")set_checked_state
set_checked_state(element, value=True, index=1, parent_element=None, timeout=10)
Description
Sets the checked state of a check box control.
Parameters
element<str> The name of the control.
value<bool> Specifies whether to check the box (True) or uncheck it (False).
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.set_checked_state("Control Name", value=True)get_checked_state
get_checked_state(element, index=1, parent_element=None, timeout=10)
Description
Gets the checked state of a check box control.
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element>The parent control object.
timeout<int> The maximum time to wait for the control, in seconds.
Return value
Returns True if the check box is checked; otherwise, False.<bool>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
checked_state = wnd.get_checked_state("Control Name")get_selected
get_selected(element, index=1, parent_element=None, timeout=10)
Description
Gets the selection state of a control (e.g., a radio button or list item).
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Return value
True if the control is selected; otherwise, False.<bool>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
checked_state = wnd.get_selected("Control Name")get_property
get_property(element, property_name, index=1, timeout=10)
Description
Gets the value of a specific UI Automation (UIA) property from a control.
Parameters
element<str> The name of the control.
property_name<str> The name of the UIA property.
index<int> The index to use when multiple controls have the same name.
timeout<int> The maximum time to wait for the control, in seconds.
Return value
The value of the specified property.<str>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
property_value= wnd.get_property("Notepad input box", "Name")text
text(element, index=1, parent_element=None, timeout=10)
Description
Gets the text from a control.
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Return value
The text from the control.<str>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
text = wnd.text("Control Name")pos
pos(element, index=1, parent_element=None, timeout=10)
Description
Gets the coordinates of a control's bounding rectangle.
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Return value
A dictionary containing the coordinates of the bounding rectangle with keys 'x1', 'y1', 'x2', and 'y2'.<dict>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
pos = wnd.pos("Control Name")table
table(element, index=1, parent_element=None, timeout=10)
Description
Gets the content of a table control.
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Return value
The table content, represented as a list of lists where each inner list is a row.<list>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
table_list = wnd.table("Control Name")scroll
scroll(element, percent, direction='top', index=1, parent_element=None, timeout=10)
Description
Scrolls a scroll bar to a specified percentage (0-100). The final position may deviate by up to 1% from the specified value due to limitations in the Windows API.
Parameters
element<str> The name of the control.
percent<int/float> The scroll percentage (0-100).
direction <str> The scroll direction. Available options:
top: Scrolls vertically.left: Scrolls horizontally.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.scroll("Control Name", 50)get_horizontal_scroll_percent
get_horizontal_scroll_percent(element, index=1, parent_element=None, timeout=10)
Description
Gets the current position of the horizontal scroll bar as a percentage (0-100).
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Return value
The horizontal scroll bar position as a percentage.<float>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
horizontal_scroll_percent = wnd.get_horizontal_scroll_percent("Control Name")get_vertical_scroll_percent
get_vertical_scroll_percent(element, index=1, parent_element=None, timeout=10)
Description
Gets the current position of the vertical scroll bar as a percentage (0-100).
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Return value
The vertical scroll bar position as a percentage.<float>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
vertical_scroll_percent = wnd.get_vertical_scroll_percent("Control Name")screenshot
screenshot(element, file, index=1, parent_element=None, timeout=10)
Description
Takes a screenshot of a control.
Parameters
element<str> The name of the control.
file<str> The full path, including the file name, where the screenshot will be saved.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.screenshot("Control Name", "d:\1.png")mouse_move
mouse_move(element, index=1, parent_element=None, timeout=10)
Description
Moves the mouse cursor to the center of a control.
Parameters
element<str> The name of the control.
index<int> The index to use when multiple controls have the same name.
parent_element<Element> The parent control.
timeout<int> The maximum time to wait for the control, in seconds.
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("Notepad", mode="substr")
wnd.mouse_move("Control Name")set_window_bounding_by_scale
set_window_bounding_by_scale(x1_scale, y1_scale, x2_scale, y2_scale)
Description
Resizes and repositions the window based on screen proportions.
Parameters
x1_scale<float> The horizontal position for the window's top-left corner, as a proportion of the screen width (0.0 to 1.0).
y1_scale<float> The vertical position for the window's top-left corner, as a proportion of the screen height (0.0 to 1.0).
x2_scale<float> The horizontal position for the window's bottom-right corner, as a proportion of the screen width (0.0 to 1.0).
y2_scale<float> The vertical position for the window's bottom-right corner, as a proportion of the screen height (0.0 to 1.0).
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("DingTalk", mode="substr")
wnd.set_window_bounding_by_scale(0.1,0.1,0.9,0.9)get_window_bounding
get_window_bounding()
Description
Gets the coordinates of the window's bounding rectangle.
Return value
A dictionary containing the coordinates of the window's bounding rectangle with keys 'x1', 'y1', 'x2', and 'y2'.<dict>
Example
# Notes: None
# Example:
wnd = rpa.ui.win32.catch("DingTalk", mode="substr")
pos = wnd.get_window_bounding()