JavaScript and UIPath inject, How to use JQuery or Node.js

So i have been trying to inject JS into UIPath, and that has been going fine.
I want to how ever use JQuery libraries or Node.js, how would i go about importing these into my functions, is it even possible with UIPath ? Any examples would be appreciated.

This is my current attempt to inject JQuery on, rpachallange.com, where i am trying to see if <form id="randomForm" class="js-randomForm"> is true, this should bring the alert true.

import './jquery-3.2.1.min.js';
//var $ = window.$;

function main(e){
  alert (prompt().booleanV);
}

+function prompt($) {
  var booleanV = $( "#randomForm" ).hasClass( "js-randomForm" );
}(window.jQuery);

Try this way, works for me in IE.

  function jqueryinUiPath() {
  var head = document.getElementsByTagName("head")[0];
  var script = document.createElement("script");
  script.src = "//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js";
  script.onload = function() {
     var booleanV= $( "#randomForm" ).hasClass( "js-randomForm" );
     alert(booleanV);
  };
  head.appendChild(script);
}

image

3 Likes

I guess we can do the same with Angular,not sure if it works as it uses design patterns (MVC/MVVM).

//ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js

Thank you for getting back to me, its really helped, it works great with IE. Chrome refuses to work with the code you written with JQuery, i am not sure why though.