Use Inject Js to send Javascript without specifying a Target element


I am working with a vendor to try and return some data. The vendor gave me the Javascript to run.

I can enter this Javascript in the Chrome console and see that it works that way.

I want to execute this Javascript on the page, not on a specific UiElement or on a specific selector.

How could I achieve this?

My Javascript:

function GetPolicyInfo() {
var info;
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.src = "//";
script.onload = function() {
	info = /*VENDOR's JS call goes here!*/;
return info;



We need to set a single anonymous function in Input property as the following.

First, can you try to modify function GetPolicyInfo() { to function(e,v) { ?


The code “runs” with your addition, in that it doesn’t cause a compile or a runtime error.

However, it still returns an empty value.

So, even with your suggested change, it doesn’t function as expected.

Hi @samuel.brockmann, did you manage to find any solution for your query. I am facing a similar issue. The webapp owner has provided few custom built JavaScript functions, but I am not able to get the value from them when running in context of UiPath.