F(x)

更新时间:
复制 MD 格式

catch

catch(title, mode='start', process_name=None, class_name=None, timeout=10)

Method description

Captures a window object based on its title.

Parameters

title <str> The window title.

mode <str> The window matching mode.

Options:

  • start: Matches the beginning of the title.

  • substr: Matches a substring within the title.

  • Exact: Exact Match

  • reg: Matches a regular expression.

process_name <str> The process name.

class_name <str> The window class name.

timeout <int> The timeout period in seconds to wait for the window.

Return value

Returns a window object <JavaWindow>.

Example- rpa.ui.java.catch-

# Notes: None
# The following is a code example:
java_wnd = rpa.ui.java.catch("Pycharm",mode="substr")

get_element_by_name

get_element_by_name(element, index=1, parent_element=None, timeout=10)

Method description

Retrieves a control object by its name.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Return value

Returns a control object <Element>.

Example- rpa.ui.java.get_element_by_name-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
java_elem = rpa.ui.java.get_element_by_name("JAVA_Control")

elem_count

elem_count(element, parent_element=None, timeout=10)

Method description

Returns the number of controls.

Parameters

element <str> The control name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Return value

Returns the number of controls <int>.

Example- rpa.ui.java.elem_count-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
count = rpa.ui.java.get_elem_count("JAVA_Control")

elem_wait_loaded

elem_wait_loaded(element, index=1, timeout=10)

Method description

Waits for a control to load. Returns True on success and False on failure.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

timeout <int> The timeout period in seconds to wait for the control.

Return value

Returns a boolean value that indicates whether the control loaded successfully <bool>.

Example- rpa.ui.java.elem_wait_loaded-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
flag = rpa.ui.java.elem_wait_loaded("JAVA_Control")

elem_input_text

elem_input_text(element, value, index=1, parent_element=None, simulate=True, replace=True, send_window_message=False, sent_raw=False, wait_mili_seconds=20, timeout=10)

Method description

Inputs text into a control.

Parameters

element <str> The control name.

value <str> The content to input.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

simulate <bool> Specifies whether to simulate the input.

replace <bool> Specifies whether to clear existing content before inputting the new text.

send_window_message <bool> Specifies whether to send a Windows message.

sent_raw <bool> Specifies whether to send raw keystrokes.

wait_mili_seconds <int> The interval, in milliseconds, between character inputs. This parameter applies only to simulated input. The default value is 20 and the maximum value is 100. A large value might cause a timeout.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_input_text-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
rpa.ui.java.elem_input_text("JAVA_Control","RPA_Test")

elem_input_hotkeys

elem_input_hotkeys(element, value, index=1, parent_element=None, timeout=10)

Method description

Inputs a keyboard shortcut into a control.

Parameters

element <str> The control name.

value <str> The input content.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_input_hotkeys-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
rpa.ui.java.elem_input_hotkeys("JAVA_Control","VK_BACK")

elem_click

elem_click(element, index=1, simulate=True, send_window_message=False, button='left', offset_x=0, offset_y=0, parent_element=None, timeout=10)

Method description

Clicks a control.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

simulate <bool> Specifies whether to simulate the click.

send_window_message <bool> Specifies whether to send a Windows message.

offset_x <int> The horizontal offset.

offset_y <int> The vertical offset.

button <str> The mouse button.

Options:

  • left: The left button.

  • right: The right button.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_click-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
rpa.ui.java.elem_click("JAVA_Control")

elem_double_click

elem_double_click(element, offset_x=0, offset_y=0, index=1, parent_element=None, timeout=10)

Method description

Double-clicks a control.

Parameter Description

element <str> The control name.

offset_x <int> The horizontal offset.

offset_y <int> The vertical offset.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_double_click-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
rpa.ui.java.elem_double_click("JAVA_Control")

elem_expand

elem_expand(element, index=1, parent_element=None, timeout=10)

Method description

Expands a control node.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_expand-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
rpa.ui.java.elem_expand("JAVA_Control")

elem_collapse

elem_collapse(element, index=1, parent_element=None, timeout=10)

Method description

Collapses a control node.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_collapse-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
rpa.ui.java.elem_collapse("JAVA_Control")

elem_set_selected_item_by_index

elem_set_selected_item_by_index(element, item_index, index=1, parent_element=None, timeout=10)

Method description

Selects an item from a combobox drop-down list based on its index.

Parameters

element <str> The control name.

item_index <int> The index of the item to select.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_set_selected_item_by_index-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
rpa.ui.java.elem_set_selected_item_by_index("JAVA_Control",2)

elem_set_selected_item_by_text

elem_set_selected_item_by_text(element, text, index=1, parent_element=None, timeout=10)

Method description

Selects an item from a combobox drop-down list based on its text.

Parameters

element <str> The control name.

text <str> The text of the option.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_set_selected_item_by_text-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
rpa.ui.java.elem_set_selected_item_by_text("JAVA_Control","Dropdown_Option")

elem_get_selected_items

elem_get_selected_items(element, mode='all', index=1, parent_element=None, timeout=10)

Method description

Retrieves all options or only the selected options from a combobox.

Parameters

element <str> The control name.

mode <str> The selection mode.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Return value

Returns an array of items <list>.

Example- rpa.ui.java.elem_get_selected_items-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
option_list = rpa.ui.java.elem_get_selected_items("JAVA_Control")

elem_set_checked_state

elem_set_checked_state(element, value=True, index=1, parent_element=None, timeout=10)

Method description

Sets the state of a check box.

Parameters

element <str> The control name.

value <bool> Specifies whether to select the check box.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_set_checked_state-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
rpa.ui.java.elem_set_checked_state("JAVA_Control",value=False)

elem_get_checked_state

elem_get_checked_state(element, index=1, parent_element=None, timeout=10)

Method description

Retrieves the state of a check box.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Return value

Returns the state of the check box <bool>.

Example- rpa.ui.java.elem_get_checked_state-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
state = rpa.ui.java.elem_get_checked_state("JAVA_Control")

get_selected

get_selected(element, index=1, parent_element=None, timeout=10)

Method description

Retrieves the selected state of a control.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Return value

Returns a boolean value that indicates whether the control is selected <bool>.

Example- rpa.ui.java.get_selected-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
selected_flag = rpa.ui.java.get_selected("JAVA_Control")

elem_text

elem_text(element, index=1, parent_element=None, timeout=10)

Method description

Retrieves the text from a control.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Return value

Returns the text <str>.

Example- rpa.ui.java.elem_text-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
text = rpa.ui.java.elem_text("JAVA_Control")

elem_value

elem_value(element, index=1, parent_element=None, timeout=10)

Method description

Retrieves the value from a control.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Return value

Returns the value from the control <str>.

Example- rpa.ui.java.elem_value-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
value = rpa.ui.java.elem_value("JAVA_Control")

elem_pos

elem_pos(element, index=1, parent_element=None, timeout=10)

Method description

Retrieves the coordinates of a control.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Return value

Returns the coordinates {x1, y1, x2, y2} as a dictionary <dict>.

Example- rpa.ui.java.elem_pos-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
pos_dict = rpa.ui.java.elem_pos("JAVA_Control")

elem_table

elem_table(element, index=1, parent_element=None, timeout=10)

Method description

Retrieves the table content from a control.

Parameters

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Return value

Returns the table content as a list <list>.

Example- rpa.ui.java.elem_table-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
table_data = rpa.ui.java.elem_table("JAVA_Control")

elem_screenshot

elem_screenshot(element, file, index=1, parent_element=None, timeout=10)

Method description

Screenshot control

Parameters

element <str> The control name.

file <str> The full path, including the file name, where the screenshot is saved.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_screenshot-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
path = r"D:\2_TestFileArchive\java_control_screenshot.jpg"
rpa.ui.java.elem_screenshot("JAVA_Control",path)

elem_mouse_move

elem_mouse_move(element, index=1, parent_element=None, timeout=10)

Method description

Moves the mouse cursor over a control.

Metric Description

element <str> The control name.

index <int> The index of the control if multiple controls have the same name.

parent_element <Element> The parent control object.

timeout <int> The timeout period in seconds to wait for the control.

Example- rpa.ui.java.elem_mouse_move-

# Notes:
# Before using this method, capture the corresponding control element using the control capture feature.
# The following is a code example:
rpa.ui.java.elem_mouse_move("JAVA_Control")