robot
2021.10
false
- Release Notes
- Getting Started
- UiPath Assistant
- Installation and Upgrade
- Robot Types
- Robot Components
- Licensing
- Connecting Robots to Orchestrator
- Processes and Activities
- Logging
- Robot JavaScript SDK
- Specific Scenarios
- Windows Sessions
- Login Using Thales Luna Credential System
- Login Using NShield Key Storage Provider
- Redirecting Robots Through a Proxy Server
- Executing Tasks in a Minimized RDP Window
- Using Mapped Network Drives
- Stopping a Process
- Disable Stop Button
- Custom Package Folders and Network Paths
- CrowdStrike Integration
- Troubleshooting
- Unresponsive Robot Over RDP
- Duplicate Execution Logs
- Frequently Encountered Robot Errors
- Increased Process Execution Duration
- Enforced Package Signature Verification
- Message Too Large to Process
- Errors When Running as Administrator
- NuGet Packages Not Accessible After Migration
- User Access Control Prompt and UI Automation Activities
- .NET6 Projects Fail to Run
SDK Specifications
Robot User Guide
Last updated Oct 25, 2024
SDK Specifications
The following methods and properties can be included in your custom application or web page:
The
init
method is optional. It returns the IRobotSDK
instance, which enables you to store it as a variable for later use.
UiPathRobot.init()
UiPathRobot.init()
The
Get Process
method retrieves and displays the list of available processes. If the Robot is connected to Orchestrator, it retrieves the
processes from the environment and folder the Robot is a part of. If it's not connected to Orchestrator, local processes are
displayed.
const robot = UiPathRobot.init();
robot.getProcesses()
.then(result => {
for(let i=0; i<result.length;i++){
console.log(result[i].name);
}
}, err => {
console.log(err);
});
const robot = UiPathRobot.init();
robot.getProcesses()
.then(result => {
for(let i=0; i<result.length;i++){
console.log(result[i].name);
}
}, err => {
console.log(err);
});
The
Start Job
method starts a process by its ID and input arguments, if any.
let arguments = {
"input1" : 23,
"input2" " 42,
"operation" : "add"
};
const robot = UiPathRobot.init();
robot.getProcesses()
.then(process => {
let calculatorProcess = processes.find(p => p.name.includes('Calculator'));
let job = new job(calculatorProcess.id, arguments);
robot.startJob(job).then(result => {
console.log(result.Sum);
}, err => {
console.log(err);
})
}, err => {
console.log(err);
});
let arguments = {
"input1" : 23,
"input2" " 42,
"operation" : "add"
};
const robot = UiPathRobot.init();
robot.getProcesses()
.then(process => {
let calculatorProcess = processes.find(p => p.name.includes('Calculator'));
let job = new job(calculatorProcess.id, arguments);
robot.startJob(job).then(result => {
console.log(result.Sum);
}, err => {
console.log(err);
})
}, err => {
console.log(err);
});
The
On
method is used to attach event handlers on the SDK. The UiPath JavaScript SDK comes with a built-in consent overlay displayed
every time your custom application or web page needs to connect to the Robot. This consent overlay can be overridden with
a custom handler.
const robot = UiPathRobot.init();
robot.on('consent-prompt', (consentCode) => {console.log(consentCode)});
robot.on('mising-components', () => {console.log('Missing Components')});
const robot = UiPathRobot.init();
robot.on('consent-prompt', (consentCode) => {console.log(consentCode)});
robot.on('mising-components', () => {console.log('Missing Components')});
The
Process Start
method is used to start a process by passing it input arguments, if available.
let arguments = {
"input1" : 23,
"input2" " 42,
"operation" : "add"
};
const robot = UiPathRobot.init();
robot.getProcesses()
.then(process => {
let process = processes.find(p => p.name.includes('Calculator'));
process.start(arguments).then(result => {
console.log(result.Sum);
}, err => {
console.log(err);
})
}, err => {
console.log(err);
});
let arguments = {
"input1" : 23,
"input2" " 42,
"operation" : "add"
};
const robot = UiPathRobot.init();
robot.getProcesses()
.then(process => {
let process = processes.find(p => p.name.includes('Calculator'));
process.start(arguments).then(result => {
console.log(result.Sum);
}, err => {
console.log(err);
})
}, err => {
console.log(err);
});
The
Process Start On Status
method is used to start a process and attach the status callback by passing the callback handler.
let arguments = {
"input1" : 23,
"input2" " 42,
"operation" : "add"
};
let globalHandler = (status) => {console.log(status)};
const robot = UiPathRobot.init();
robot.getProcesses()
.then(processes => {
let statusHandler = (status) => {console.log('Calculator Process Status -' + status)};
let process = processes.find(p => p.name.includes('Calculator'));
process.start(arguments)
.onStatus(globalHandler)
.onStatus(statusHandler)
.then(result => {
console.log(result.Sum);
}, err => {
console.log(err);
})
}, err => {
console.log(err);
});
let arguments = {
"input1" : 23,
"input2" " 42,
"operation" : "add"
};
let globalHandler = (status) => {console.log(status)};
const robot = UiPathRobot.init();
robot.getProcesses()
.then(processes => {
let statusHandler = (status) => {console.log('Calculator Process Status -' + status)};
let process = processes.find(p => p.name.includes('Calculator'));
process.start(arguments)
.onStatus(globalHandler)
.onStatus(statusHandler)
.then(result => {
console.log(result.Sum);
}, err => {
console.log(err);
})
}, err => {
console.log(err);
});
The
Stop Process
method is used to stop an executing or running robot process. Returns a promise which is resolved on successful cancellation
of running robot process.
try {
const robot = UiPathRobot.init();
const robotProcessId = 'MyRunningRobot';
const processes = await robot.getProcesses();
const myProcess = processes.find(function(process){return process.name.includes(robotProcessId)});
await robot.stopProcess(myProcess);
console.log(robotProcessId +' cancelled successfully');
} catch (e) {
console.log(robotProcessId +' cancellation failed -'+ e);
}
try {
const robot = UiPathRobot.init();
const robotProcessId = 'MyRunningRobot';
const processes = await robot.getProcesses();
const myProcess = processes.find(function(process){return process.name.includes(robotProcessId)});
await robot.stopProcess(myProcess);
console.log(robotProcessId +' cancelled successfully');
} catch (e) {
console.log(robotProcessId +' cancellation failed -'+ e);
}
The
Job On
method is used to attach an event handler to retrieve on going process statuses.
let arguments = {
"input1" : 23,
"input2" " 42,
"operation" : "add"
};
const robot = UiPathRobot.init();
robot.getProcesses().then(processes => {
let calculatorProcess = processes.find(p => p.name.includes('Calculator'));
let job =new job(calculatorProcess.id, arguments);
job.on('status', (robotStatus) => {console.log(robotStatus)});
robot.startJob(job).then(result => {
console.log(result.Sum);
}, err => {
console.log(err);
})
}, err => {
console.log(err);
});
let arguments = {
"input1" : 23,
"input2" " 42,
"operation" : "add"
};
const robot = UiPathRobot.init();
robot.getProcesses().then(processes => {
let calculatorProcess = processes.find(p => p.name.includes('Calculator'));
let job =new job(calculatorProcess.id, arguments);
job.on('status', (robotStatus) => {console.log(robotStatus)});
robot.startJob(job).then(result => {
console.log(result.Sum);
}, err => {
console.log(err);
})
}, err => {
console.log(err);
});
The
Settings
method allows you to edit the default port number and poll interval time in milliseconds.
const robot = UiPathRobot.init();
robot.settings.portNumber = 1234;
robot.settings.pollTimeInterval = 1000
const robot = UiPathRobot.init();
robot.settings.portNumber = 1234;
robot.settings.pollTimeInterval = 1000
class Settings {
portNumber: number;
pollTimeInterval: number;
}
class Settings {
portNumber: number;
pollTimeInterval: number;
}
class RobotProcess {
id: string;
name: string;
constructor(id: string, name: string);
start: (inArguments?: any) => JobPromise;
}
class RobotProcess {
id: string;
name: string;
constructor(id: string, name: string);
start: (inArguments?: any) => JobPromise;
}
interface IRobotSDK {
settings: Settings;
getProcesses(): Promise<Array<RobotProcess>>;
init(): IRobotSDK;
on(eventName: string, callback: (argument?: any) => void): void;
startJob(job: Job): Promise<JobResult>;
}
interface IRobotSDK {
settings: Settings;
getProcesses(): Promise<Array<RobotProcess>>;
init(): IRobotSDK;
on(eventName: string, callback: (argument?: any) => void): void;
startJob(job: Job): Promise<JobResult>;
}
/**
* Job result model containing all output arguments from the process.
* Empty if there are no out arguments.
*/
class JobResult {
[Key: string]: any;
}
/**
* Job result model containing all output arguments from the process.
* Empty if there are no out arguments.
*/
class JobResult {
[Key: string]: any;
}
class Job {
processId: string;
argument?: any;
jobId: string;
constructor(processId: string, argument?: any);
on(eventName: string, eventHanlder: (argument?: any) => void): void;
}
class Job {
processId: string;
argument?: any;
jobId: string;
constructor(processId: string, argument?: any);
on(eventName: string, eventHanlder: (argument?: any) => void): void;
}