studio
2023.10
false
- 发行说明
- 入门指南
- 设置和配置
- 自动化项目
- 依赖项
- 工作流类型
- 文件比较
- 自动化最佳实践
- 源代码控件集成
- 调试
- 诊断工具
- 工作流分析器
- 变量
- 参数
- 导入的命名空间
- 编码自动化
- 基于触发器的 Attended 自动化
- 录制
- 用户界面元素
- 控制流程
- 选取器
- 对象存储库
- 数据抓取
- 图像与文本自动化
- Citrix 技术自动化
- RDP 自动化
- Salesforce 自动化
- SAP 自动化
- VMware Horizon 自动化
- 日志记录
- ScreenScrapeJavaSupport 工具
- Webdriver 协议
- Studio 测试
- 扩展程序
- 故障排除
重要 :
新发布内容的本地化可能需要 1-2 周的时间才能完成。

Studio 用户指南
上次更新日期 2025年6月4日
在编码自动化中使用导入的库项目
本教程将向您介绍如何在编码自动化中使用导入库项目中的对象。该示例演示了如何使用导入的库项目中的对象存储库元素和工作流。给定的场景涉及自动化 Acme 网站,会填写学生记分卡并将其添加到数据库中。
- 安装“用户界面自动化活动”版本 23.10.13 或更高版本。
注意:我们建议您使用与您正在使用的主要版本相对应的最新次要版本。例如,如果您使用的是活动包的主要版本 23.10,我们建议您将其升级到可用的最新次要版本 (
23.10.x
)。 - 发布 Acme 库示例,并将其安装在您正在进行的项目中。
创建一个库项目以存储自动化 Acme 应用所必需的用户界面元素,特别是用于填写学生记分卡的元素。此外,在库项目中创建低代码 (
.xaml
) 或编码工作流 (.cs
),以便稍后在另一个编码自动化中使用。
- 创建一个名为
AcmeLibrary
的库项目。 - 捕获要在“对象存储库”和“描述符”部分中使用的所有用户界面元素。
- 在“文件”组中新建一个“编码工作流”。
在另一个项目中导入库时,此步骤对于启用对编码自动化中的对象存储库的访问至关重要。
- 将主要的低代码工作流重命名为
Send message box
,并添加具有以下文本的“消息框”活动:“您已为 Acme 中的学生添加了新的计分卡。”注意:您也可以按照本教程中列出的步骤将“消息框”活动重新创建为编码工作流。 - 保存库项目并将其发布到订阅源。
您将在编码自动化的另一个项目中安装并使用此已发布的库。
创建库项目后,将其安装到另一个项目中以利用其可重用资产,包括对象存储库元素和工作流,低代码 (
.xaml
) 和编码 (.cs
) 均可。
Tip: When using UI Automation coded automation APIs, remember that the overloads with
IScreenDescriptor
or IElementDescriptor
are intended to work with Object Repository elements, while the overloads with TargetAnchorableModel
are meant for use with native selectors obtained through the UI Explorer. Visit UI Automation coded automation APIs to learn how to leverage selectors with UI Automation coded automation APIs.
- 在“文件”组中,新建编码工作流。
- 转到“管理包”并安装先前创建的库项目。
- 在“文件”组中,新建工作流。
- 将工作流命名为
notifyStudentScoreCardAdded
。 - 导航至“活动”面板的“已安装”部分。
- 搜索您导入的库项目的名称(在此示例中为
AcmeLibrary
)。 - 将
Send message box
活动拖放到notifyStudentScoreCardAdded
中。现在,notifyStudentScoreCardAdded
具有与导入的库项目中的Send message box
工作流相同的行为。
- 将工作流命名为
- 为了增强可读性,您可以在工作流开头应用
using
语句,将导入的对象存储库应用程序定义为变量。示例如下:using app = <ProjectName>.ObjectRepository.Descriptors
。使用此方法,您可以轻松地按以下格式调用描述符:app.<AppName>.<ScreenName>.<UiElementName>
在此示例中 ,我们定义了 Acme 对象存储库 ,如下所示:namespace UsingImportedLibraryProjects { using AcmeApp = AcmeLibrary.ObjectRepository.Descriptors;
namespace UsingImportedLibraryProjects { using AcmeApp = AcmeLibrary.ObjectRepository.Descriptors; - Now you can automate the given scenario within Acme. Start by opening the Acme login screen using the Open coded automation API.
[Workflow] public void Execute() { // 1.Open the Acme app on the Login screen var AcmeLoginScreen = uiAutomation.Open(AcmeApp.Acme.LoginScreen);
[Workflow] public void Execute() { // 1.Open the Acme app on the Login screen var AcmeLoginScreen = uiAutomation.Open(AcmeApp.Acme.LoginScreen); - Type in the necessary credentials for logging into Acme, using the TypeInto coded automation API.
// 2.Type in the necessary credentials AcmeLoginScreen.TypeInto(AcmeApp.Acme.LoginScreen.Email, "john.doe2023@uipath.com"); AcmeLoginScreen.TypeInto(AcmeApp.Acme.LoginScreen.Password, "12345678");
// 2.Type in the necessary credentials AcmeLoginScreen.TypeInto(AcmeApp.Acme.LoginScreen.Email, "john.doe2023@uipath.com"); AcmeLoginScreen.TypeInto(AcmeApp.Acme.LoginScreen.Password, "12345678"); - Use the Click coded automation API, along with a native selector, to click the Login button.
// 3.Use a native selector to click the Login button AcmeLoginScreen.Click(Target.FromSelector("<webctrl tag='BUTTON' type='submit'/>"));
// 3.Use a native selector to click the Login button AcmeLoginScreen.Click(Target.FromSelector("<webctrl tag='BUTTON' type='submit'/>")); - The login process takes you to the Dashboard screen in the Acme web application. Therefore, use the Attach coded automation API to focus on the new screen.
// 4. Focus on the Dashboard screen var DashboardScreen = uiAutomation.Attach(AcmeApp.Acme.Dashboard);
// 4. Focus on the Dashboard screen var DashboardScreen = uiAutomation.Attach(AcmeApp.Acme.Dashboard); - Select the Students entry on the website, using the Click coded automation API.
// 5. Click the Students entry DashboardScreen.Click(AcmeApp.Acme.Dashboard.Students);
// 5. Click the Students entry DashboardScreen.Click(AcmeApp.Acme.Dashboard.Students); - Select Score card to open the Students - Score Card form, using the Click coded automation API.
// 6. Click Score card, to start filling in a student score card DashboardScreen.Click(AcmeApp.Acme.Dashboard.Students.ScoreCard);
// 6. Click Score card, to start filling in a student score card DashboardScreen.Click(AcmeApp.Acme.Dashboard.Students.ScoreCard); - Focus on the Students - Score Card screen, using the Attach coded automation API.
// 7. Focus on the Score Card screen where you fill in the necessary information var ScoreCardScreen = uiAutomation.Attach(AcmeApp.Acme.StudentsScoreCard);
// 7. Focus on the Score Card screen where you fill in the necessary information var ScoreCardScreen = uiAutomation.Attach(AcmeApp.Acme.StudentsScoreCard); - Fill in half of the fields in the Students - Score Card form using the TypeInto coded automation API, and elements from the Object Repository.
ScoreCardScreen.TypeInto(AcmeApp.StudentsScoreCard.StudentEmail, "john.doe@uipath.com"); ScoreCardScreen.TypeInto(AcmeApp.Acme.StudentsScoreCard.FirstName, "John"); ScoreCardScreen.TypeInto(AcmeApp.Acme.StudentsScoreCard.LastName, "Doe"); ScoreCardScreen.TypeInto(AcmeApp.Acme.StudentsScoreCard.ParentEmail, "johnny.doe@uipath.com"); ScoreCardScreen.TypeInto(AcmeApp.Acme.StudentsScoreCard.Tuition, "Private");
ScoreCardScreen.TypeInto(AcmeApp.StudentsScoreCard.StudentEmail, "john.doe@uipath.com"); ScoreCardScreen.TypeInto(AcmeApp.Acme.StudentsScoreCard.FirstName, "John"); ScoreCardScreen.TypeInto(AcmeApp.Acme.StudentsScoreCard.LastName, "Doe"); ScoreCardScreen.TypeInto(AcmeApp.Acme.StudentsScoreCard.ParentEmail, "johnny.doe@uipath.com"); ScoreCardScreen.TypeInto(AcmeApp.Acme.StudentsScoreCard.Tuition, "Private"); - Fill in the rest of the fields in the form using the TypeInto coded automation API in combination with native selectors that you discover through the UI Explorer.
ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='mathematics' tag='INPUT' />"), "A"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='physics' tag='INPUT' />"), "B"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='biology' tag='INPUT' />"), "C"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='chemistry' tag='INPUT' />"), "A"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='geography' tag='INPUT' />"), "C"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='history' tag='INPUT' />"), "A"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='english' tag='INPUT' />"), "A"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='computer Science' tag='INPUT' />"), "C"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='professorComments' tag='INPUT' />"), "The student is doing okay, very hardworking and does its best");
ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='mathematics' tag='INPUT' />"), "A"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='physics' tag='INPUT' />"), "B"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='biology' tag='INPUT' />"), "C"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='chemistry' tag='INPUT' />"), "A"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='geography' tag='INPUT' />"), "C"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='history' tag='INPUT' />"), "A"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='english' tag='INPUT' />"), "A"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='computer Science' tag='INPUT' />"), "C"); ScoreCardScreen.TypeInto(Target.FromSelector("<webctrl id='professorComments' tag='INPUT' />"), "The student is doing okay, very hardworking and does its best"); - Select Add score card details using the Click coded automation API.
// 10. Click the "Add score card details" button using an Object Repository descriptor ScoreCardScreen.Click(AcmeApp.Acme.StudentsScoreCard.AddScoreCardDetailsButton);
// 10. Click the "Add score card details" button using an Object Repository descriptor ScoreCardScreen.Click(AcmeApp.Acme.StudentsScoreCard.AddScoreCardDetailsButton); - 使用
RunWorkflow()
方法调用从库项目导入的工作流。为方法提供项目内工作流的路径。// 11. Invoke imported workflow from library RunWorkflow("notifyStudentScoreCardAdded.xaml");
// 11. Invoke imported workflow from library RunWorkflow("notifyStudentScoreCardAdded.xaml"); - Close the browser tabs you opened to automate the scenario, using the
Dispose()
coded automation API.// 12. Close the applications/browsers you opened, to finish he automation ScoreCardScreen.Dispose();
// 12. Close the applications/browsers you opened, to finish he automation ScoreCardScreen.Dispose();
To follow the steps and try out the tutorial yourself, see the following sample project: Using imported library projects in coded automations. The file contains the library project, as well.