Robot.js sample

Hello,

I intend to launch a robot from web application that’s why I used the “UiPath Robot JS SDK”. I had a problem with running the sample: I want to hosted on the web server but I couldn’t figure out how doing it.
Could you please help me?

Hi @enchirah_maatki

Have you tried using this

Thanks
Ashwin S

1 Like

thank’s for replying,
I’m already folowing this gide and I can’t run the robot embadding sample application on the web.
Could you help me please?

@enchirah_maatki I would suggest taking a look at the developer guide:

Hello @evan.cohen !

Thank’s fo replying, i really appreciate it.
Here what i get from the guide, could you justify me if i’m wrong

**First, i should include the “UiPathRobot.js” file in my web application repertory.
**Second, Include a javascript file in my web app repertory that contain :
- This line "import {UiPathRobot} from ‘@uipath\robot’;
- The function async (){…}

I’m waiting for your answer :blush:

I suggest you download the Boilerplate sample from UiPathRobot.js | Public Preview Download and take a look at how it works there. Good luck and please post again if you have other questions!

Hi @evan.cohen,

Actually, I did download it and I used the guide to see how it works, but I didn’t get it specially that I don’t use javascript for development.
Could anyone explain to me, specifically where to implement the async function and the “UiPathRobot. j’s” file in my application.
Thank’s for your help.

After you include the SDK library you can implement it in a standalone JS file (like what is done in the Boilerplate Sample) or within the HTML itself, for example:

<!-- Insert the name of the first available process into the DOM -->
<script src="//download.uipath.com/js/1.1.1/UiPathRobot.js"></script>
<script type="text/javascript">
(async () => {
    try{
        const processes = await UiPathRobot.getProcesses()
        document.write("First process:" + processes[0].name);
    } catch(e) { 
        console.error(e) 
    }
})()
</script>
<!-- Before the closing of your HTML </body> tag -->
</body>
2 Likes

@evan.cohen,
Thank’s for your answer, it works now :blush:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

Hello @enchirah_maatki
we need any server where I Hosted Index.html or I run from local machine?

It won’t work from the local file:// system for security reasons, but you can use localhost. I described this in response to another forum post here: UiPathRobot.js Now in Public Preview! (Get the SDK & Sample App now!) - #23 by evan.cohen

1 Like

Thanks @evan.cohen