UiPath Documentation
robot
2026.10
false
Robot 开发者指南
  • Robot JavaScript SDK
    • 关于 Robot JavaScript SDK
    • 配置步骤

配置步骤

Robot JavaScript SDK 的先决条件和配置步骤:JavaScript 插件安装和应用程序访问设置。

本页介绍在自定义网页应用程序中使用机器人 JavaScript SDK 的先决条件和配置,包括设置浏览器和机器人同意访问权限、安装 SDK 以及配置 JavaScript 插件。

先决条件​

自动化项目必须满足以下先决条件才能使用 Robot JavaScript SDK:

  • UiPath Robot 2026.10 installed
  • 在机器人计算机上安装 UiPath JavaScript 插件

允许访问​

运行 UiPath 机器人 JavaScript 插件时,您必须获得对自定义应用程序或网页的访问权限,以连接到机器人。访问权限由两步对话框处理 — 必须确认两个步骤才能运行 RobotJS。这两个对话框都支持自动化,如以下各节所述。

浏览器访问对话框​

此步骤是指浏览器请求打开 UiPath Assistant 的权限。

“自动接受浏览器访问”对话框​

The uipath-web protocol is the UiPath Robot web protocol handler. Browsers ask for permission before they open it. You can automate this dialog through your browser's enterprise policies.

备注:

Based on the browser used, different settings need to be configured. For the exact policy and value format, see the enterprise policy documentation of your browser.

机器人同意对话框用于允许机器人 JavaScript SDK 和机器人执行程序之间建立连接。

UIPATH_ROBOTJS_ALLOWLIST 系统环境变量会自动接受机器人同意对话框。

The value is a list of origins separated by semicolons. Each origin includes the scheme, for example https://myapp.contoso.com. Add the port only if it is not the default (80 or 443).

示例:

UIPATH_ROBOTJS_ALLOWLIST=https://cloud.uipath.com;https://mydomain.com
UIPATH_ROBOTJS_ALLOWLIST=https://cloud.uipath.com;https://mydomain.com

The Robot already accepts the UiPath cloud origins by default, so you only add your own origins. For the default list, see the AllowUrlList key in Configuration files.

Robot JavaScript SDK​

This SDK provides all the necessary methods and properties you can include in your custom application or web page. It is available as an npm package with TypeScript bindings. To include it in your project:

  1. 在项目目录的根目录运行以下命令:

    npm install --save @uipath/robot
    npm install --save @uipath/robot
    

要改为加载带有<script>标签的 SDK,请使用包中的dist/js/UiPathRobot.js 。

备注:

版本 1.3.3,最后一个发布到 download.uipath.com,在https://download.uipath.com/js/1.3.3/UiPathRobot.js仍可用。较新的版本仅在 npm 上发布。

插件设定​

要配置加载项设置:

  1. Open the UiPath.config file: %ProgramFiles%\UiPathPlatform\Robot\<version>\UiPath.config for a per-machine installation, or %LocalAppData%\Programs\UiPathPlatform\Robot\<version>\UiPath.config for a per-user installation. For details, see Configuration files.
  2. 将 ListenerPort 和 TokenExpiryInDays 参数添加到 <robotJsSettings> 部分。默认情况下,该部分不包含任何键:
<robotJsSettings>
    <add key="ListenerPort" value="2323" />
    <add key="TokenExpiryInDays" value="30" />
</robotJsSettings>
<robotJsSettings>
    <add key="ListenerPort" value="2323" />
    <add key="TokenExpiryInDays" value="30" />
</robotJsSettings>
属性描述
ListenerPortThe UiPath.RobotJS.ServiceHost.exe starts a HttpListener on the configured port and contains the information about other local listeners from the active user session on that system. The port value must match the one configured in the SDK Settings. The default value is 2323.
TokenExpiryInDaysAny request coming from a new domain needs to have consent from the user to allow access of UiPath Robots from a web application. These consents are valid for the said number of days mentioned in this setting. The default value is 30.

After you edit the file, restart the UiPath RobotJS Service service for the changes to take effect. For the steps, see Restarting robot components.

此页面有帮助吗?

连接

需要帮助? 支持(opens in new window)

想要了解详细内容? UiPath Academy(opens in new window)

有问题? UiPath 论坛(opens in new window)

保持更新