- 入门指南
- 设置和配置
- 自动化项目
- 依赖项
- 工作流类型
- 控制流程
- 文件比较
- 自动化最佳实践
- 源代码控件集成
- 调试
- 日志记录
- 诊断工具
- 工作流分析器
- 变量
- 参数
- 导入的命名空间
- 编码自动化
- 基于触发器的 Attended 自动化
- 对象存储库
- ScreenScrapeJavaSupport 工具
- 扩展程序
- Studio 测试
- 故障排除
远程调试
在具有不同配置的目标计算机上远程调试 Studio 自动化,以重现生产环境行为。
自动化在不同计算机上的表现可能有所不同。如果要在生产环境中运行自动化的计算机的配置与设计该自动化的计算机不同(例如,该计算机具有不同的硬件或软件、不同的权限或处于隔离的网络中),则应使用该计算机上的机器人测试并调试流程。
使用远程调试,您可以在部署到远程计算机的机器人(包括可以运行跨平台项目的 Linux 机器人)上运行和调试有人值守和无人值守的流程。
您可以使用以下其中一种连接类型连接到远程机器人:
- 远程计算机 - 与远程计算机上的机器人建立 TCP/IP 连接。
- 无人值守机器人 - 使用 Orchestrator 连接到同一租户中的无人值守机器人。
使用远程调试要求在 Studio 中打开项目。 如果您正在使用来源控件,为确保使用的是最新项目版本,我们建议启用“发布前强制签入”设计设置。
您无法对编码自动化执行远程调试。
远程计算机连接
先决条件
- Studio 计算机和远程计算机之间存在 TCP/IP 连接。
- 远程机器人的版本与 Studio 相同。
- 兼容的 .NET Framework 已安装在远程计算机上。
步骤
要使用远程计算机连接远程运行或调试项目,请执行以下操作:
- 在远程计算机上,配置机器人以接受远程调试请求。
- 如果在 Orchestrator 中强制执行交互式身份验证,并且您想要运行或调试 Unattended 流程,请确认远程机器人是否满足以下条件之一:
- 已使用交互式登录连接到 Orchestrator。
- 已使用客户端凭据或计算机密钥进行连接,且用户也已从 Assistant 登录。
- 使用客户端凭据或计算机密钥连接,不会有任何用户从 Assistant 登录,并且在计算机的 Orchestrator 中启用了故障排除会话。 有关更多信息,请参阅“调试无人值守的流程”。
- 在 Studio 中:
- 设置与远程机器人的连接。
- 确保已启用远程执行。
- 运行或调试项目。
结果
您的项目使用远程计算机连接运行或调试。当远程机器人执行工作流时,您可以在 Studio 中监控执行情况。
在远程计算机上配置机器人
在将远程机器人用于调试之前,必须配置该计算机上的 UiPath.RemoteDebugging.Agent 实用程序,以接受来自 Studio 的远程调试请求:
- 导航到安装目录:
- 对于 Windows 机器人 - 在 UiPath 安装文件夹中打开命令提示符(对于按计算机安装的情形,默认为
%PROGRAMFILES%\UiPath\Studio,按用户安装的情形则为%localappdata%\Programs\UiPath\Studio)。 - 对于 Linux 机器人 - 从命令行终端导航到
/root/application。 - 对于 macOS 机器人 - 从 zsh 导航到
/Applications/UiPath Assistant.app/Contents/Robot。
- 对于 Windows 机器人 - 在 UiPath 安装文件夹中打开命令提示符(对于按计算机安装的情形,默认为
- 运行以下命令:
- 对于 Windows 机器人 -
UiPath.RemoteDebugging.Agent.exe enable --port <port_number> --password <pasword> --verbose - 对于 Linux 机器人 -
~/application # dotnet ./UiPath.RemoteDebugging.Agent.dll enable --port <port_number> --password <pasword> --verbose - 对于 macOS 机器人 -
dotnet UiPath.RemoteDebugging.Agent.dll enable --port <port_number> --password <pasword> --verbose命令中的参数都是可选的:
--port <port_number>- 输入用于从 Studio 接收远程调试命令的端口。如果未提供任何端口,则默认使用端口 8573。 该端口必须在防火墙中打开,并且尚未与其他应用程序绑定。--password <password>- 输入在设置与远程调试代理的连接时必须在 Studio 中提供的密码。--verbose- 将额外信息记录到控制台。
- 对于 Windows 机器人 -
- 显示以下消息:
Robot on machine <hostname> is waiting for remote debugging instructions on port <port_number> - 记下主机名和端口号值,在 Studio 中设置连接时必须提供这些值。
在机器人处于远程调试状态时,无法从 Orchestrator 或本地 Assistant 执行任何有人值守或无人值守作业。您甚至可以向未经许可安装机器人的计算机发送远程调试命令。
设置远程计算机连接
-
在 Studio 中,选择“调试”选项卡。
-
In the ribbon, select the arrow under Remote Session, and then select Configure Remote Session to open the Remote Session Settings window.
-
从“连接类型”下拉列表中,选择“远程计算机”。
-
在相应的框中提供以下信息:
- “主机”- 远程计算机的主机名或 IP 地址。
- “端口”- 要使用的端口。默认端口为 8573。
- “密码”- 在机器人计算机上配置远程调试代理时提供的密码(如适用)。
-
(可选)要使用当前设置测试连接,请选择“测试连接” 。
-
选择“保存”。
无人值守机器人连接
先决条件
- Studio 和目标机器人已连接到同一 Orchestrator 租户。
- 远程机器人的版本与 Studio 相同。
- Studio、目标机器人和 Orchestrator 正在运行 2021.10 版或更高版本。
- 登录到 Studio 的用户有权启动作业,以及在与目标机器人相同的文件夹上下文中创建和删除存储桶和存储文件。此外,机器人帐户必须具有存储桶和存储文件的查看权限。
- 已配置 Unattended Robot,并且计算机具有以下可用运行时许可证的其中一个:Unattended、NonProduction 或 Testing。
备注:
Orchestrator 2022.4 及更高版本支持测试运行时以进行远程调试。
- 在调试前台流程时,系统会在 Orchestrator 中为机器人启用“运行前台自动化”选项。
- 如果使用故障排除会话,则只能在将机器人连接到 Orchestrator 后启用该会话。
步骤
要使用连接到 Orchestrator 的无人值守机器人远程运行或调试项目,请执行以下操作:
- 设置与远程机器人的连接。
- 确保已启用远程执行。
- 运行或调试项目。
结果
您的项目在连接到 Orchestrator 的 Unattended Robot 上运行或调试。当远程机器人处理执行时,您可以在 Studio 中监控执行。
设置无人值守机器人连接
-
在 Studio 中,选择“调试”选项卡。
-
In the ribbon, select the arrow under Remote Session, and then select Configure Remote Session to open the Remote Session Settings window.
-
从“连接类型”下拉列表中,选择“无人值守机器人”。
-
要使用从 Studio 状态栏选择的Orchestrator 文件夹中的任何已连接计算机,请选择“保存” 。如果要选择要连接的计算机,请使用以下选项:
- Session Mode - Select how the robot runs your work:
- Remote run only - Each run or debug session runs on the robot as a separate Orchestrator job. UI Automation activities are designed against your own machine.
- Live authoring - The robot keeps one remote session for the whole connection. For more information, refer to Live authoring.
- Orchestrator folder - Displays the Orchestrator folder that the user, machine, and hostname belong to.
- “用户”- 选择将无人值守机器人分配给 Orchestrator 文件夹的帐户。
- “计算机”- 从 Orchestrator 文件夹中选择计算机或模板。
- “主机名”- 从已连接的计算机列表中选择一台计算机。
- 显示实时流 - 选择以查看机器人执行的操作。有关更多信息,请参阅实时流和远程控制。
备注:
如果对 Orchestrator 中的帐户设置进行了更改,请使用 Studio 状态栏中的按钮刷新 Orchestrator 连接,以便在此窗口中反映更改。
- Session Mode - Select how the robot runs your work:
When you start a remote debugging session on an unattended robot, Studio waits 40 seconds by default for the robot to report that it is ready. If signing in to the remote machine takes longer, set the UIPATH_STUDIO_AGENT_READY_TIMEOUT_SECONDS environment variable on the Studio machine to the number of seconds to wait, between 10 and 1800, and then restart Studio.
远程执行
When a remote debugging connection is established, clicking the Remote Session button in the ribbon toggles between remote and local execution. Before you select a run or debug operation, make sure the desired option is enabled (remote or local).
-
只要该按钮以灰色突出显示,所有运行和调试操作(“调试文件”、“运行文件”、“调试项目”、“运行项目”、“进入/跳过/退出”,“测试活动”、“运行至此活动/从此活动运行”)都将在远程机器人上执行。
-
只要该按钮未以灰色突出显示,所有运行和调试操作都将在本地机器人上执行。
远程调试体验类似于本地调试体验,并且可用于本地调试的所有功能也可用于远程调试。当通过“调试”选项卡触发的远程执行正在进行时,Studio 状态栏将显示为绿色。
根据用于远程调试的连接类型,远程机器人会获取执行项目所需的活动包,如下所示:
- 远程计算机连接 - Studio 将项目依赖项和活动订阅源(包来源)的列表发送到远程机器人,然后远程机器人将使用 Studio 提供的订阅源下载所需的包。
- Unattended Robot 连接 - Studio 仅将项目依赖项列表发送到远程机器人,然后远程机器人将使用 Orchestrator 订阅源和远程机器人上配置的活动订阅源下载所需的包。
对于 Unattended Robot 连接,选择“显示实时流”,您便可以查看机器人实时执行的操作。在远程执行期间,将打开一个新的实时流窗口,您可以移动该窗口并调整其大小。 您也可以进行远程控制,而无需暂停自动化以进行深入调试,或者在执行被阻止(例如,被需要单击的用户界面元素阻止)时。工作流结束后,实时流窗口将立即消失。 虽然无服务器 Automation Cloud 机器人不需要其他操作,但 Windows 机器人需要设置 VNC 服务器。
不建议在远程调试期间注销您的帐户。
已知限制
- 只有 Automation Cloud Orchestrator 和 Automation Suite Orchestrator 支持“显示实时流”选项。
- 仅当在服务模式下部署 Unattended Robot 上的机器人服务时,“显示实时流”选项才有效。有关更多信息,请参阅机器人服务。
- 使用远程计算机连接时,如果暂停调试的时间较长,Studio 中可能会发生“连接已关闭”错误,即使远程计算机上的连接似乎仍处于活动状态。为避免此问题,您可以增加云端或本地负载均衡器中的 TCP 空闲超时。
- 仅 Unattended Robot 连接支持远程调试长时间运行的工作流。
- 使用无人值守机器人连接时,选择“画中画”选项不会在单独的会话中启动执行作业。
- 在切换到 Windows 项目时,为跨平台项目中的 Unattended Robot 连接设置的 [默认] Cloud Robot - Serverless 选项仍然存在,这会在运行工作流时导致不兼容错误。
Live authoring
With an Unattended Robot connection set to the Live authoring session mode, the robot keeps one remote session open for the whole connection. Runs, debug sessions, and remote commands all use this session, and the robot doesn't start a separate Orchestrator job for each of them. While the session is open:
- Indicate and recording in UI Automation activities work on the remote machine. The project needs a UI Automation package, such as
UiPath.UIAutomation.Activities. - The screen of the remote machine is streamed in the Remote View panel.
- The Studio status bar shows the remote machine that you are connected to.
Only one Studio at a time can stream the screen of a remote machine. If another Studio is already streaming it, the Remote View panel displays The remote screen is being viewed from another Studio. Select Take over live stream to move the stream to your Studio. The other Studio stops streaming the screen.
When the remote session ends, the robot restores the Windows session that it found on the remote machine.
To use live authoring:
- In the Remote Session Settings window, select the Unattended Robot connection type.
- Under Session Mode, select Live authoring.
- Select the user, machine, or hostname to connect to, and then select Save.
关闭远程调试连接
To disable the remote debugging connection, when no debugging execution is in progress, open the Remote Session Settings window, set the Connection Type to Disabled, and then select Save.