How to work with Inject JS

code

#1

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


#2

hi @sushree.suravibuyan

please go through with these posts:

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

Regards…!!
Aksh


How to pass input parameter in Inject java script
How to inject java script
#3

@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.


#4

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


#5

@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


#6

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


#7

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


#8

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


#9

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