Page 1 of 1

ExecuteScript to Variables

Posted: Thu Apr 11, 2019 2:57 pm
by Lyuba Boerma
Hello)
for my project i need to make a test which simulated Scanning bar-codes .
i need to do a lot of same actions to different items
So my question is....can i convert script value to a variable?

Everything what is inside ( ) make a variable

Code: Select all

repo.Dom.Self.ExecuteScript("BarcodeListener.applyBarcode('Blablabla')");
Delay.Milliseconds(1000);
for example

Code: Select all

repo.Dom.Self.ExecuteScript(varBarcodeActions);
Delay.Milliseconds(1000);

Is it possible??

Thanks for help

Re: ExecuteScript to Variables

Posted: Fri Apr 12, 2019 7:58 am
by Stub
You can easily call onto other code from a Code Module. While I have no idea how your code is structured:

Code: Select all

BarcodeListener listener = new BarcodeListener (repo.someItemInfo);
listener.applyBarcode("Blah Blah");
But that probably misses your point since I'm not familiar with this ExecuteScript API.

Re: ExecuteScript to Variables

Posted: Fri Apr 12, 2019 8:58 am
by odklizec
Hi,

Since the RunExecute script is basically a simple string, you can, of course, use variable as ExecuteScript parameter. If you want to use it in code, you can do it as you suggested in your initial post. You just have to use it in UserCode of selected recording or custom created code module.
ExecuteScriptVar.png

Re: ExecuteScript to Variables

Posted: Fri Apr 12, 2019 2:15 pm
by Lyuba Boerma
Thank you! It is working!))
I Made it with variables, as you showed :D

Re: ExecuteScript to Variables

Posted: Mon Apr 29, 2019 7:05 am
by Unmeshatodkar
Thanks odklizec, It was valuable answer for me also. Great help!