Image

更新时间:
复制 MD 格式

click

click(element, button='left', index=1, offset_x=0, offset_y=0, window=None, timeout=10)

Description

Clicks a control.

Parameters

element <str>: The name of the control.

button <str>: The mouse button.

Options:

  • left: The left button.

  • right: The right button.

index <int>: If multiple controls match, specifies the index of the desired control.

offset_x <int>: The horizontal offset.

offset_y <int>: The vertical offset.

window <object>: The window object that contains the control.

timeout <int>: The timeout period, in seconds, for waiting for the control.

Example call: rpa.ui.image.click

# Note:
# Before using this method, capture the corresponding image control using the image recording feature.
# The following code shows an example:
rpa.ui.image.click("image_control")

double_click

double_click(element, index=1, offset_x=0, offset_y=0, window=None, timeout=10)

Description

Double-clicks a control.

Metric description

element <str>: The name of the control.

index <int>: If multiple controls match, specifies the index of the desired control.

offset_x <int>: The horizontal offset.

offset_y <int>: The vertical offset.

window <object>: The window object that contains the control.

timeout <int>: The timeout period, in seconds, for waiting for the control.

Example call: rpa.ui.image.double_click

# Note:
# Before using this method, capture the corresponding image control using the image recording feature.
# The following code shows an example:
rpa.ui.image.double_click("image_control")

input_text

input_text(element, value, simulate=False, index=1, window=None, wait_mili_seconds=20, timeout=10)

Description

Enters text into a control.

Parameters

element <str>: The name of the control.

value <str>: The content to enter.

simulate <bool>: Specifies whether to simulate the input.

index <int>: If multiple controls match, specifies the index of the desired control.

window <object>: The window object that contains the control.

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

timeout <int>: The timeout period, in seconds, for waiting for the control.

Example Call: rpa.ui.image.input_text

# Note:
# Before using this method, capture the corresponding image control using the image recording feature.
# This method clicks the anchor point of the image control and then simulates the input.
# The following code shows an example:
rpa.ui.image.input_text("image_control", "RPA Test")

pos

pos(element, index=1, window=None, timeout=10)

Description

Retrieves the coordinates of a control.

Parameters

element <str>: The name of the control.

index <int>: If multiple controls match, specifies the index of the desired control.

window <object>: The window object that contains the control.

timeout <int>: The timeout period, in seconds, for waiting for the control.

Return value

A dictionary that contains the coordinates: {x1, y1, x2, y2}<dict>.

Sample call: rpa.ui.image.pos

# Note:
# Before using this method, capture the corresponding image control using the image recording feature.
# The following code shows an example:
pos_dict = rpa.ui.image.pos("image_control")

mouse_move

mouse_move(element, index=1, offset_x=0, offset_y=0, window=None, timeout=10)

Description

Moves the mouse cursor over a control.

Parameters

element <str>: The name of the control.

index <int>: If multiple controls match, specifies the index of the desired control.

offset_x <int>: The horizontal offset.

offset_y <int>: The vertical offset.

window <object>: The window object that contains the control.

timeout <int>: The timeout period, in seconds, for waiting for the control.

Sample Call: rpa.ui.image.mouse_move

# Note:
# Before using this method, capture the corresponding image control using the image recording feature.
# The following code shows an example:
rpa.ui.image.mouse_move("image_control")

wait_loaded

wait_loaded(element, index=1, window=None, timeout=10)

Description

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

Parameters

element <str>: The name of the image control.

index <int>: If multiple controls match, specifies the index of the desired control.

window <object>: The window object that contains the control.

timeout <int>: The timeout period, in seconds, for waiting for the control.

Return value

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

Example: rpa.ui.image.wait_loaded

# Note:
# Before using this method, capture the corresponding image control using the image recording feature.
# The following code shows an example:
flag = rpa.ui.image.wait_loaded("image_control")

count

count(element)

Description

Returns the number of matching controls.

Parameters

element <str>: The name of the control.

Return value

Returns the count of controls <int>.

Example Call: rpa.ui.image.count

# Note:
# Before using this method, capture the corresponding image control using the image recording feature.
# The following code shows an example:
count = rpa.ui.image.count("image_control")