activities
latest
false
- 概述
- 加密
- 数据库
- Java
- Python
- 网页 API
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。
新发布内容的本地化可能需要 1-2 周的时间才能完成。
开发者活动
上次更新日期 2026年5月21日
以下示例说明了如何使用“反序列化 XML”或“执行 XPath”等活动来反序列化和分析 XML 文件。您可以在“UiPath.WebAPI.Activities ”包中找到这些活动。
备注:
Download and extract the archive with the project in this example and copy the folder MissingScreenshotSampleProject-ForTestPurposes to your project folder.
此自动化流程的构建方法如下:
- 打开 Studio ,创建一个新“流程”。
- 将“序列”容器拖动至“工作流设计器”。
-
创建以下变量:
变量名称 变量类型 默认值 SelectedProjectPath字符串 WorkflowXMLString字符串 WorkflowXMLXDocument ScreenshotAttributes对象
-
- Add a Select Folder activity inside the Sequence.
- In the Properties panel, add the variable
SelectedProjectPathin the SelectedFolder field.
- In the Properties panel, add the variable
- 将“遍历循环”活动添加到“选择文件夹”活动之后。
- Add the value
WorkflowFilein the ForEach field. - Add the expression
Directory.GetFiles(SelectedProjectPath, "*.xaml", SearchOption.AllDirectories)in the Values field.
- Add the value
- Add a Read Text File in the Body container of the For Each activity.
- Add the value
WorkflowFilein the FileName field. - In the Properties panel, add the variable
WorkflowXMLStringin the Content field.
- Add the value
- 将“反序列化 XML”活动添加到“读取文本文件”之后。
- Add the variable
WorkflowXMLStringin the XMLString field. - In the Properties panel, add the value
WorkflowXMLin the XMLDocument field.
- Add the variable
- 将“执行 XPath”活动添加到“反序列化 XML”活动之后。
- Add the value
WorkflowXMLin the Existing XML field. - Add the expression
"//@InformativeScreenshot"in the XPath Expression field. - In the Properties panel, add the variable
ScreenshotAttributesin the Result field.
- Add the value
- 将“遍历循环”活动添加到“执行 XPath”活动之后。
-
Add the value
Attributein the ForEach field. -
Add the expression
CType(ScreenshotAttributes, IEnumerable).Cast(Of XAttribute)in the Values field. -
Select the Body container of the activity and create the following variable:
变量名称 变量类型 默认值 ScreenshotFileExists布尔值
-
- Add a Log Message activity inside the Body container of the For Each activity.
- 在“行”字段中添加表达式“
"Looking for: " + SelectedProjectPath + "\.screenshots\" + Attribute.Value + ".png"”。
- 在“行”字段中添加表达式“
- 将“存在路径”活动添加到“日志消息”活动之后。
- Select the File option from the Path File drop-down list.
- Add the expression
SelectedProjectPath + "\.screenshots\" + Attribute.Value + ".png"in the XPath Expression field.
- 将“ IF 条件”活动添加到“存在路径”活动之后。
- 在“条件”字段中添加表达式“
Not ScreenshotFileExists”。
- 在“条件”字段中添加表达式“
- Add a Log Message activity inside the Then field of the If activity.
-
Select the Warn option from the Level drop-down list.
-
在“行”字段中添加表达式“
String.Format("Could not find the screenshot file {0}.png referenced by file {1}", Attribute.Value, WorkflowFile)”。
-
- 运行流程。出现提示时,选择“MissingScreenshotSampleProject-ForTestPurposes ”文件夹。系统将读取文件夹中的 XML 工作流文件并对其进行反序列化。有关 XAML 中引用的屏幕截图的信息用于识别和记录在文件夹中找到和丢失的屏幕截图。
您可在此处下载示例。