订阅

UiPath 活动

UiPath 活动指南

About the UIAutomationNext Activities Pack

UI Automation Next uses a combination of technologies for identifying and locating UI elements: full selector, fuzzy selector, and image, all wrapped in an anchor-based algorithm.

📘

Note:

Starting with v2020.10, the UIAutomationNext package has been deprecated and the existing UIAutomation package has been expanded to include all the modern features previously available in UiAutomationNext. You are also able to install the unified UIAutomation activities package even on Studio versions 2020.4.1 and lower. This displays all the classic and modern activities in the activities pane. Read more about the Modern Design Experience.

UI Automation Next contains activities that help you automate the most common UI interactions. The first step in automating UI interactions is to define the desktop application or web page to interact with by adding a Use Application/Browser activity. You then add the activities to automate in that application or web page inside the Use Application/Browser activity.

To speed up the process, you can use the App/Web Recorder that automatically generates activities by capturing your actions on the screen.

📘

Note:

The Extract Table Data activity and App/Web Recorder are not compatible with Studio versions 2019.10.4 and earlier.

Web Browser Support

The UI Automation Next package supports the following web browsers:

  • Internet Explorer 8.0 or greater
  • Google Chrome 64 版或更高版本
  • Mozilla Firefox 版本 52.0 或更高版本
  • Microsoft Edge Chromium version 79 or greater on Windows 10 version 1803 or greater. Edge Legacy is not supported.

目标方法

UI Automation Next uses a combination of the following methods to identify UI elements:

  • Selector - An XML fragment that stores the attributes of an element and its parent elements, including the target application.
  • Fuzzy Selector - A selector that takes into account possible changes in the attributes of an element, identifying them based on a pattern, rather than on an exact match. This method works best when used with anchors.
    You can find more information about selectors in the Studio guide.
  • Image - An image in the application window that identifies the element, for example an icon or a button.

关于目标和锚点

A target is a UI element you want to interact with, for example a button to click, a text box to type into, or a part of a web page from which to copy text.
An anchor is another nearby element that helps to uniquely identify the target. When you indicate a target, UiPath tries to identify and automatically select an anchor. You can also manually add up to three anchors.

何时使用锚点

当目标元素并非唯一时,锚点很有用。例如,桌面应用程序中的表单通常包含多个相似的文本框,可在其中输入各种数据。通过查看数据旁边的标签,您可以确定需要输入哪些数据。同样,将文本框的标签添加为其锚点时,Robot 会使用锚点来标识要键入内容的文本框。

在某些情况下,需要多个锚点才能将目标与称为重复项的其他类似元素区分开。例如,如果表单包含帐单地址和收货地址部分,则其中的文本框会出现两次,并带有相同的标签,因此您需要同时添加标签(例如“邮政编码”)和该部分的标题(例如“帐单地址”)作为锚点,以识别正确的目标。

指定目标

在大多数情况下,定义目标所需要做的只是在屏幕上指向该目标并单击。应用程序会检测识别目标和任何合适锚点所需的方法,并自动生成其属性。

要指定目标:

  1. Click Indicate target on screen inside a UI Automation Next activity.
    The target selection mode is opened. As you start moving the mouse, all the recognized UI elements are highlighted. The Selection Options window appears on the screen with information about the target identification status and additional options.
  2. 将鼠标指针放在所需的元素上,确保将其突出显示,然后单击。
    • 如果标识了目标元素,其将突出显示为绿色。
      • 如果还自动选择了锚点,则该锚点将以蓝色突出显示。
      • 如果未自动选择锚点,则可以单击附近有助于识别目标的元素(例如标签或标题),将其添加为锚点。
      • 要添加其他锚点,请将鼠标悬停在目标元素上,在悬停菜单中选择“添加锚点edit_element_add_anchoredit_element_add_anchor,然后单击要添加为锚点的元素。
    • 如果由于屏幕上存在其他过多的相似元素而无法识别目标,则该元素将以红色突出显示,而相似元素将以黄色突出显示为重复项。单击屏幕上的另一个元素,将其添加为锚点。
      • 如果选择有效,则目标和锚点分别以绿色和蓝色突出显示。
      • 如果目标和锚点以红色突出显示,则选择仍然无效。将鼠标悬停在您指定为目标的元素上,然后在悬停菜单中单击“添加锚点”edit_element_add_anchoredit_element_add_anchor,以添加第二个锚点。必要时重复此操作,以添加第三个锚点。
  3. 要完成目标标识,请在“选择选项”窗口中单击“确认”。您也可以通过单击目标悬停菜单中的 edit_element_confirmedit_element_confirm 或按键盘上的回车键来进行确认。
    目标已配置完成,并且此活动会显示目标和已添加的所有锚点的屏幕快照。

“选择选项”窗口中提供了其他选项,可帮助您指定元素:

  • If an element is not visible on your screen or the application is not in the correct state, you can press F2 on your keyboard to pause element selection while you set the application to the correct state.
    This is useful for elements that require an additional action to appear on screen, or disappear easily from it. For example, if you want to indicate specific elements in drop-down or hover menus, you can pause selection while you click the drop-down or move the mouse pointer on the hover menu to activate them.
  • 切换到“图像选择模式”。在键盘上按 F3 键可以更改为“仅基于图像的标识”,然后使用鼠标从应用程序窗口中选择一个可见区域,以用作目标或锚点。
  • 更改用户界面框架。默认情况下,专有框架用于访问目标应用程序窗口。如果未检测到目标,请尝试通过按键盘上的 F4 来更改框架。对于较旧的应用程序,请选择 AA(主动式辅助)。对于较新的应用程序,请选择 UIA(Microsoft 用户界面自动化)。选择目标后,更改用户界面框架的选项不再可用。

编辑目标

If the target is not identified correctly during project execution, you can edit the target and its anchors after you have indicated it by selecting Options buttonOptions button > Edit Target in the body of the activity. This opens the selection mode with the target and any identified anchors highlighted. A menu is displayed when you hover the mouse over a target or anchor.

  • To remove a target or an anchor, hover it, and then click Delete delete_element_menudelete_element_menu in the hover menu. If you remove a target, the first element you click is added as the new target.
  • To add an anchor for a target, click the element to add as an anchor. Depending on the settings of your project, you may need to click Add Anchor edit_element_add_anchoredit_element_add_anchor in the hover menu of the target first. You can add up to three anchors for each target.
  • To edit a target or an anchor, hover it, and then click Settings edit_element_menuedit_element_menu in the hover menu. The properties of the methods used for detecting the element can be edited from the Advanced Settings section of the Selection Options window:
    • 选取器/模糊选取器
      • Edit the selector using the corresponding text box. To copy the selector for pasting in another element or for editing in the UI Explorer, click Copy copy_buttoncopy_button next to it.
        You can also use variables in attribute values. The variables must be surrounded in double curly brackets, for example <wnd name='da{{var1}}'/> adds the value of var1 to the selector. The default value of the variable is used at design time.
      • 对于模糊选取器,可以将相应的滑块从 0.4 拖动到 1,以更改“选取器精度”的级别。此度量表示要搜索的属性与要查找的属性之间的相似度。要查找具有更高相似性的结果,请增加该值。默认值为 0.7。
    • 图像
      • 通过将相应的滑块从 0.4 拖动到 1 来更改“图像精度”的级别。此度量表示要搜索的图像与要找到的图像之间的相似度。如果要查找的图像可能与要搜索的图像略有不同,您可以降低精度。默认值为 0.8。
    • 通过清除/选中方法名称旁边的复选框来禁用/启用方法。
    • Verify how unique a method is by clicking Show all matches eye_buttoneye_button next to it. This checks all the elements in the window and highlights all that have similarities with the currently selected element in yellow.
    • Click Apply to save the changes, and then click Validate if you want to validate the selection. To save the selection, click Confirm.

验证您的选择

通过验证,您可以使用所有选定的方法和锚点检查目标,从而检查当前选择在识别目标方面的效果如何。验证结果将显示在“选择选项”窗口的顶部。如果需要调整,屏幕上会显示一条消息,其中包含有关如何改进选择的信息。

The performance of each method is displayed in the Advanced Settings section of the Selection Options window using one of the following icons:
Validate firstValidate first The method was the first to successfully identify the element.
Validate successValidate success The method successfully identified the element.
Validate duplicateValidate duplicate The method failed to identify the element because too many duplicates were found.
Validate failValidate fail The method failed to identify the element.

2 个月前更新


About the UIAutomationNext Activities Pack


建议的编辑仅限用于 API 参考页面

You can only suggest edits to Markdown body content, but not to the API spec.