0

From Prerender tool:

Google, Facebook, Twitter, Yahoo, and Bing are constantly trying to view your website... but they don't execute javascript. That's why we built Prerender. Prerender is perfect for AngularJS SEO, BackboneJS SEO, EmberJS SEO, and any other javascript framework.

Referring to this article. I try to run the UiPathRobot.js on my server. But currently that framework is always executed client-side. This does not make any sense. So I tried to let it run on the server and found prerender-node package on node.js.

But I tried so much and it was not working or it still executed client-side. So this is the basic setup that I use:

const express = require('express');
const prerender = require('prerender-node');
const app = express();
app.use(prerender());
app.get('*', (req, res) => {
  res.sendFile('C:\\Users\\name\\Documents\\Git\\rpa_robotjs\\index.html');
});
app.listen(6543);

What to add now, so that it shows up a prerendered version of:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="/css/styles.css"> 
    <script type="text/javascript" src="scripts/UiPathRobot.js"></script>
    <script type="text/javascript" src="scripts/helper.js"></script>
  </head>
  <body>
    <header>
      <div class="container">
        <img src="/images/logo.png" alt="logo" class="logo-image">
        <span class="logo-text">PROEJCT</span>
      </div>
      <div class="subcontainer">
        <h1>Robot Process Automation</h1>
      </div>
    </header>
    <main>
      <article>
        <h2>Overview of processes</h2>
        <div id="port"></div>
        <div id="username"></div>
        <div id="error-message"></div>
        <div id="robot-status"></div>
        <table>
          <tr>
            <td valign="top">
              <div id="divRobots" style ="border: 1px solid black;"></div>
              <button style="margin-top: 10px;" id="GetRobotProcesses" onclick="refreshRobotProcesses();">Refresh Robot Process</button>    
            </td>
          </tr>
        </table>
      </article>
    </main>
  </body>
</html>

So first question is how the UiPathRobot.js is executed server-side?

kwoxer
  • 3,734
  • 4
  • 40
  • 70
  • 1
    Server-side rendering and executing some code server-side are not necessarily the same thing. Do you want to use this library server-side or do you want to server-side render the UI it produces? If we're talking about the latter then I'm afraid only someone that developed this library can help you. With no out-of-the-box support it's practically impossible (prerender works though). Though as far as I can understand the thread on that forum they told you it's not possible and they are not interested in implementing SSR (which I agree with, there's no point, purpose of SSR is SEO). – Sergiu Paraschiv Oct 09 '20 at 14:05
  • Would be enough when the library runs server-side. The UI production can run client-side yes. Maybe you have an idea, although they say it does not work. I think that does now mean it's impossible. =) – kwoxer Oct 09 '20 at 14:09
  • 1
    I'm pretty sure the problem is this library is designed to run in a browser. Running JS "on the server" usually means running it in Node. You can of course run it in a browser on your server, but that's not what you are looking for, right? – Sergiu Paraschiv Oct 12 '20 at 08:23
  • Yeah it's not designed to be used in my way. But maybe there is a workaround to let it run simulated on the server? That UiPathRobot.js may not be delivered to the client via network. So the page needs to be prerendered somehow. I already tried prerender, prerender-node without success. Maybe using ajax requests would be a solution. Or is this all nonsense and I should move to use the REST API of UiPath instead? WDYT? – kwoxer Oct 12 '20 at 08:31
  • 1
    It's "nonsense" indeed, sorry :) It's a UI library, generates some UI on which a user can do stuff. 99.9% of the times libraries like this have to run in a browser because the input/output relies on DOM which is very hard to emulate outside of an actual browser. You might be able to pre-render it server-side and send the generated HTML to a browser but what good is that if the rest of the interaction happens in that browser? – Sergiu Paraschiv Oct 12 '20 at 10:07
  • If it's too hard, I'll do all the things clean with the rest api and having a more proper solution that is not having those issues. Thanks anyways. – kwoxer Oct 12 '20 at 10:38

1 Answers1

0

Well the question was non-sense I must say. I found out that UiPathRobot.js needs to run on the same machine where it is accessed.

So any question about security does not make sense. It has no security at all because it does not need some.

For the case you look for having a real server with a frontend, check out the node.js version of Orchestrator. This works well and is very safe as it runs completely on server-side and only the frontend is shown to the user.

kwoxer
  • 3,734
  • 4
  • 40
  • 70