- Robot JavaScript SDK
设置字段
Robot JavaScript SDK 浏览器插件的设置字段,包括端口号、轮询间隔、遥测和应用程序来源配置选项。
SDK 的设置
Robot JavaScript SDK 的“设置”属性使您可以个性化并改善对浏览器插件设置的控制。
class Settings {
portNumber: number;
pollTimeInterval: number;
disableTelemetry: boolean;
appOrigin: string;
}
class Settings {
portNumber: number;
pollTimeInterval: number;
disableTelemetry: boolean;
appOrigin: string;
}
| 属性 | 描述 |
|---|---|
portNumber | Lets you configure custom ports on which the back-end services run on. The default port number is 2323. |
pollTimeInterval | 用于指定机器人 JavaScript SDK 跟踪网页中流程执行的时间(以毫秒为单位)。默认值为 250 毫秒。此值决定了网页浏览器的轮询频率 |
disableTelemetry | 用于禁用遥测标志。默认值为 false。 |
appOrigin | Identifies the application that uses the SDK in the SDK telemetry. The default value is picked up from the window.location.origin property. |
const robot = UiPathRobot.init();
robot.settings.portNumber = 1234;
robot.settings.pollTimeInterval = 1000;
robot.settings.disableTelemetry = true;
robot.settings.appOrigin = 'MyApp';
const robot = UiPathRobot.init();
robot.settings.portNumber = 1234;
robot.settings.pollTimeInterval = 1000;
robot.settings.disableTelemetry = true;
robot.settings.appOrigin = 'MyApp';
插件设定
Add-on settings are configured in 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.
The robotJsSettings section of the configuration file can contain the following keys. By default, the section is empty and the add-on uses the default values, 2323 for ListenerPort and 30 for TokenExpiryInDays:
<robotJsSettings>
<add key="ListenerPort" value="2323" />
<add key="TokenExpiryInDays" value="30" />
</robotJsSettings>
<robotJsSettings>
<add key="ListenerPort" value="2323" />
<add key="TokenExpiryInDays" value="30" />
</robotJsSettings>
| 属性 | 描述 |
|---|---|
ListenerPort | UiPath.RobotJS.ServiceHost.exe在配置的端口上启动HttpListener ,并包含该系统上活动用户会话中的其他本地侦听器的相关信息。端口值必须与在“SDK 设置”中配置的端口值相符。 |
TokenExpiryInDays | 来自新域的任何请求都需要获得用户的同意,以允许从网页应用程序访问 UiPath 机器人。这些同意在此设置中提到的上述天数内有效。 |
默认覆盖
可以自定义从新域提出请求时显示的同意屏幕。Robot JavaScript SDK 附带两个屏幕:
同意提示
当从新域提出访问 UiPath 助理的请求时,将显示 consent-prompt 覆盖。
缺少组件
当本地计算机上不存在所需插件时,将显示 missing-components 覆盖。
可以配置叠加消息,如以下示例所示。
// Consent code will be written to the console instead of showing default overlay
// Error logged to console when required components are missing instead of showing
// default error overlay
const robot = UiPathRobot.init();
robot.on('consent-prompt', function(consentCode){ console.log(consentCode) });
robot.on('missing-components', function(){ console.log('Missing components') });
// Consent code will be written to the console instead of showing default overlay
// Error logged to console when required components are missing instead of showing
// default error overlay
const robot = UiPathRobot.init();
robot.on('consent-prompt', function(consentCode){ console.log(consentCode) });
robot.on('missing-components', function(){ console.log('Missing components') });