How to work with Inject JS

I require help regarding the usage of Inject JS activity. Thank you.

hi @sushree.suravibuyan

please go through with these posts:

https://www.uipath.com/activities-guide/inject-js-script

Regards…!!
Aksh

3 Likes

@aksh1yadav - I’ve downloaded InjectJS example/sample script from above links, I’ve noticed selector of email field is changed hence script is throwing error.

Where we can address this type of issue so UiPath can keep script up-to-date so New users of UiPath not face any issues when they download this examples/samles.

1 Like

hi @kuldip.gohil

I can Understand your concern and appreciate this effort and idea from your side.

Let me clear the things for you:

For this error their will be many reason - like the example site we are using and they have changed their html codings and structures. so we can not always look into this but this should be learning for all thay should not dependes on the solutions to direct download and run and use.

The main thing about knowledge forum is to Guide all .
So please first understand and review the things and put into your efforts and idea and use them. and the above thing is learning that selectors might be vary.

@badita i really thanks to UiPath team and badita for their updates and information they are sharing here. and @kuldip.gohil thanks to notice such things. UiPath team will work on things we can understand but these things we can also handle.

Keep learning and Keep sharing…!!

Thanks& Regards…!!
Aksh

4 Likes

@aksh1yadav - Thanks for understanding my concern, I noticed HTMl is changed.

Yes definitely we can handle such things but I was just thinking its better if we proactively raise example issues somewhere and examples are maintained well so it will not become useless at some point of time.

Even I am happy to test & update examples which have errors. :slight_smile:

Thanks,
Kuldip Gohil

1 Like

I have also gone through that example and i am also getting some selector errors. I will work on it.
Thank you @aksh1yadav.

2 Likes

@aksh1yadav What does the json file in the example folder correspond to? It is named project.json.

hi @sushree.suravibuyan

The project.json file is used to define project metadata, compilation information, and dependencies. It stores the details about project i.e. like uipath version you are developing, main file name, project folder name and so on.

By using this you can change project description and other dependencies as well “configurationOptions” to configure per robot resolution change setting. Uipath team were planning to move this option in project.json from uipath.settings file.

Regards…!!
Aksh

Hi @aksh1yadav,

injectjs activity is working fine only with a single static function in a js file, but my js file is required to call another external js file like the below.

script type=“text/javascript” src=“https://portal.abc.com/Style%20Library/js/Utility_JS/aes.js”>
script type=“text/javascript” src=“https://portal.abc.com/Style%20Library/js/Utility_JS/pad-nopadding-min.js”>
function(element, input)
{
return input;
}

With the above sample, I’m getting an exception HRESULT:0x80020101, ElementOperationException

1 Like