Using the Click action

The Click action in the Mouse package enables a bot to simulate mouse clicks. This action enables to capture the UI element such as the screen or window, and to specify the click event and click button.

Prerequisites

Ensure that the screen scale and resolution of the Bot Creator device is the same as the Bot Runner device. If the screen scale and resolution are different, the bot might fail when deployed to the Bot Runner device.

If you are using Internet Explorer, the bot waits until the browser is completely rendered and is in a ready state before executing the Click action.

Procedure

Follow these steps to add a Click action:

  1. In the Actions palette, double-click or drag the Click action from the Mouse package.
  2. Specify the window in which to capture the mouse click:
    Choose from the Application, Browser, or Variable tab.
    OptionDescription
    Application Select from a list of currently active windows.
    Note: You can use the Screen option to capture coordinates on the device screen, however we recommend specifying a window because screen sizes can change, which distorts the captured coordinates.
    Browser Select from a list of supported browser tabs. Review the following information based on the platform where you created the automation:
    • Windows

      This option supports Google Chrome, Chromium-based Microsoft Edge, and Internet Explorer browsers.

    • macOS

      This option supports only Google Chrome and Safari web browsers.

    Variable Select an existing window variable to specify the title of the application window title.
    Note: This option deactivates the Capture option. Use this option only after you have completed the capture step.

    窗口标题字段中插入通配符 (*),以搜索可以更改的窗口标题。 可以在值的开头、中间或结尾指定一个或多个通配符 (*)。 例如,要对标题中包含 Microsoft 的任何窗口执行操作,请将通配符添加到值之前或之后来指示任何字符串:*Microsoft*bot 首先会搜索确切的窗口标题 (Microsoft),如果找不到匹配项,它会搜索标题中任何位置带有 Microsoft 一词的窗口。

    您可以使用正则表达式 (regex) 来标识窗口标题。 将每个正则表达式条件选择为字符串模式,然后输入值。 默认情况下,窗口标题字段区分大小写。

    要识别浏览器标题,您可以启用区分大小写选项以匹配字母大小写,或禁用该选项以识别字母大小写不匹配的窗口标题。
    Note: 确保您系统上安装的最低 Bot Agent 版本是随 Automation 360 v.26 发布的版本。 如果存在随 Automation 360 v.25 或更早版本发布的 Bot Agent 版本,则默认情况下,将仅通过匹配字母大小写(区分大小写)识别窗口标题。
    例如,要匹配所有以单词开头、后跟 - Notepad 的窗口标题名称,您可以输入字符串* -Notepad,或者仅为与此模式匹配的窗口标题使用模式((\w)\s)*document-Notepad
    Note:
    • 当您使用类型为字符串的正则表达式,并将 -title 作为任何 action 的窗口标题的输入值时,bot 可能会遇到运行时错误。 为了防止运行时错误,请确保在将字符串输入添加为 *-title 时,具有特定标题的应用程序已打开。 星号 (*) 只是一个字符,而不是通配符。
    • 当您使用类型为 Pattern 的正则表达式,并将 -title 作为任何 action 的窗口标题的输入值时,bot 可能会遇到运行时错误,因为输入值 *-title 是不正确的。

      请确保使用有效的正则表达式模式。

  3. Optional: 选择重设窗口大小选项以指定窗口尺寸。
    此选项可提供更可靠的 bot。 它根据录制任务的尺寸调整窗口的大小,这增强了 bot 识别目标对象的能力。
    • 如果在您录制任务时窗口最大化,则此选项处于取消选中状态。
    • 如果在录制任务时窗口未达到最大尺寸,则默认选择此选项,并且宽度和高度字段会自动填充窗口尺寸。
    Note: 此选项仅适用于可以调整大小的窗口。 它不适用于桌面任务栏选项。
  4. Click Capture coordinate.
    The selected window appears.
  5. Drag the mouse to select the click spot and left-click to capture it.
    The captured spot appears in the Preview section with the coordinates underneath.
  6. In the Button option, specify the button to click.
    Choose from Left Button, Right Button, or Middle Button.
  7. In the Event option, specify the event.
    Choose from Click, Double click, Button up, or Button down.
  8. Click Save.