JavaWindow
activate
activate()
Description
Activates the window, bringing it to the foreground.
Code sample
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.activate()maximize
maximize()
Description
Maximizes the window.
Code sample
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.maximize()minimize
minimize()
Description
Minimizes the window.
Code sample
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.minimize()hide
hide()
Description
Hides the window.
Code sample
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.hide()show
show()
Description
Shows a previously hidden window.
Code sample
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.show()wait_disappear
wait_disappear(timeout=30)
Description
Waits for the window to disappear.
Parameters
timeout<int> The timeout duration in seconds. The default is 30.
Code sample
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.wait_disappear(timeout=10)close
close()
Description
Closes the window.
Code sample
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.close()get_element_by_name
get_element_by_name(element, index=1, parent_element=None, timeout=10)
Description
Retrieves an element by its name.
Parameters
element<str> The name of the element.
index<int> The 1-based index of the element to use if multiple elements share the same name. The default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Return value
The matching element object<Element>.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_elem = java_wnd.get_element_by_name("java_element_name")count
count(element, parent_element=None)
Description
Counts the number of elements that match the specified criteria.
Parameters
element<str> The name of the element to count.
parent_element<Element> The parent element object to search within. Default is None.
Return value
The number of matching elements<int>.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
count = java_wnd.count("java_element_name")wait_loaded
wait_loaded(element, index=1, parent_element=None, timeout=10)
Description
Waits for the specified element to load. Returns True if the element loads successfully, otherwise False.
Parameters
element<str> The name of the element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Return value
A boolean indicating whether the element loaded successfully<bool>.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
flag = java_wnd.wait_loaded("java_element_name",timeout=5)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
Enters text into an element.
Parameters
element<str> The name of the element.
value<str> The text to input.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
simulate<bool> Specifies whether to simulate input. Default is False.
replace<bool> If True, clears existing content before entering the new text. The default is True.
send_window_message<bool> Specifies whether to send a Windows message. This parameter applies only when simulate is False. The default is True.
sent_raw<bool> Specifies whether to send raw keystrokes. This parameter applies only when simulate is False. The default is False.
wait_mili_seconds<int> The delay in milliseconds between each keystroke. Applies only when simulate is True. A large value might cause a timeout. Default: 20. Max: 100.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.input_text("java_element_name","RPA_Test")input_hotkeys
input_hotkeys(element, value, replace=False, index=1, parent_element=None, timeout=10)
Description
Sends a hotkey (keyboard shortcut) or a combination of hotkeys to an element. For more details, see input_hotkey Usage and virtual key code list.
Parameters
element<str> The name of the element.
value<str> The virtual key code for the hotkey.
replace<bool> Specifies whether to clear existing content. Default is False.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.input_hotkeys("java_element_name","VK_RETURN")click
click(element, button='left', simulate=True, send_window_message=False, offset_x=0, offset_y=0, index=1, parent_element=None, timeout=10)
Description
Clicks an element.
Parameters
element<str> The name of the element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
simulate<bool> Specifies whether to simulate the click. Default is True.
send_window_message<bool> Specifies whether to send a Windows message. This parameter applies only when simulate is False. The default is False.
offset_x<int> The horizontal offset from the element's center. Default is 0.
offset_y<int> The vertical offset from the element's center. Default is 0.
button<str> The mouse button to use for the click.
Available options:
left: Left mouse button (default).right: Right mouse button.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.click("java_element_name")double_click
double_click(element, offset_x=0, offset_y=0, index=1, parent_element=None, simulate=True, timeout=10)
Description
Double-clicks an element.
Parameters
element<str> The name of the element.
offset_x<int> The horizontal offset from the element's center. Default is 0.
offset_y<int> The vertical offset from the element's center. Default is 0.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
simulate<bool> Specifies whether to simulate the double-click. The default is True.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.double_click("java_element_name")expand
expand(element, index=1, parent_element=None, timeout=10)
Description
Expands an element node, such as in a tree view.
Parameters
element<str> The name of the element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.expand("java_element_name")collapse
collapse(element, index=1, parent_element=None, timeout=10)
Description
Collapses an element node, such as in a tree view.
Parameters
element<str> The name of the element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.collapse("java_element_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 by its visible text.
Parameters
element<str> The name of the combobox element.
text<str> The text of the item to select.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.set_selected_item_by_text("java_element_name","sample_option_text")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 by its index.
Parameters
element<str> The name of the combobox element.
item_index<int> The index of the item to select.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.set_selected_item_by_index("java_element_name", 2)get_selected_items
get_selected_items(element, mode='selected', index=1, parent_element=None, timeout=10)
Description
Retrieves all items or only the selected ones from a combobox.
Parameters
element<str> The name of the combobox element.
mode<str> The selection mode.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Return value
A list of item texts<list>.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
option_list = java_wnd.get_selected_items("java_element_name")set_checked_state
set_checked_state(element, value=True, index=1, parent_element=None, timeout=10)
Description
Checks or unchecks a checkbox or radio button.
Parameters
element<str> The name of the checkbox element.
value<bool> Set to True to check the element or False to uncheck it. The default is True.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.set_checked_state("java_element_name", value=False)get_checked_state
get_checked_state(element, index=1, parent_element=None, timeout=10)
Description
Retrieves the checked state of a checkbox or radio button.
Parameters
element<str> The name of the checkbox element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Return value
The checked state of the element (True or False)<bool>.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
state = java_wnd.get_checked_state("java_element_name")get_selected
get_selected(element, index=1, parent_element=None, timeout=10)
Description
Checks if an element is selected.
Parameters
element<str> The name of the element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Return value
True if the element is selected; otherwise, False<bool>.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
state = java_wnd.get_selected("java_element_name")text
text(element, index=1, parent_element=None, timeout=10)
Description
Retrieves the text content of an element.
Parameters
element<str> The name of the element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Return value
Returns the text content of the element<str>.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
text = java_wnd.text("java_element_name")value
value(element, index=1, parent_element=None, timeout=10)
Description
Retrieves the value of an element.
Parameters
element<str> The name of the element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Return value
Returns the value of the element<str>.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
value = java_wnd.value("java_element_name")pos
pos(element, index=1, parent_element=None, timeout=10)
Description
Retrieves the screen coordinates of an element.
Parameters
element<str> The name of the element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Return value
Returns a dictionary with the element's bounding box coordinates, e.g., {'x1': 100, 'y1': 100, 'x2': 200, 'y2': 200}<dict>.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
pos_dict = java_wnd.pos("java_element_name")table
table(element, index=1, parent_element=None, timeout=10)
Description
Gets the content of a table element.
Parameters
element<str> The name of the table element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Return value
Returns the table content as a list of lists<list>.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
table_data = java_wnd.table("java_element_name")screenshot
screenshot(element, file, index=1, parent_element=None, timeout=10)
Description
Captures a screenshot of an element.
Parameters
element<str> The name of the element.
file<str> The absolute path, including the filename, to save the screenshot file.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
path = r"D:\test_files\java_element_screenshot.jpg"
java_wnd.screenshot("java_element_name", path)mouse_move
mouse_move(element, index=1, parent_element=None, timeout=10)
Description
Hovers the mouse cursor over an element.
Parameters
element<str> The name of the element.
index<int> The 1-based index to use if multiple elements share the same name. Default is 1.
parent_element<Element> The parent element object to search within. Default is None.
timeout<int> The timeout in seconds to wait for the element. Default is 10.
Code sample
# Note: Before using this method, capture the target element first.
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")
java_wnd.mouse_move("java_element_name")