Pass parameter to Run or create custom commands

When working on larger applications there are many functions that need to be repeated for different elements. Unfortunately UI.Vision doesn’t accommodate that well at the moment. I was wondering if it would be possible to add the option to pass a parameter (such as an element) to Run, or to let the user create their own custom commands that take a parameter.


Already replyed here

The solution there involves saving the value to a csv and then retrieving it. That is very inconvenient if the user is going to call the method many times with a different value each time. What I am looking for is something like this that can be ran:
“Command”: “MyCustomCommand”,
“Target”: “${ElementBeingTested}”,
“Value”: “”

A script for MyCustomCommand can be written that will manipulate the element passed in Target.

This would be useful if the user wants to run the same operations on a bunch of different elements.

MyCustomCommand have not sense, kantu have a set of command you can not modify the internal souce, try another solution to automate your work.

Right you can’t modify the source, but the idea is what if you put a bunch of currently defined commands together and then put them into their own command. Like how when programming you can chunk a bunch of code together and put it into a function. It makes it easier to maintain a large program since you can abstract away parts of it.
The problem I am having is I run the same 4 commands a bunch just on a different target each time. It makes it challenging to read what’s happening if every command is listed. To solve this I could make a macro, but the problem with that is I can’t pass a macro a unique target.

An alternative to writting a custom command would be if I could pass a parameter to the run command. For example, the above code would be converted to
“Command”: “Run”,
“Target”: “MyCustomCommand”,
“Value”: “${ElementBeingTested}”

Hello I can automate any page and I do not understand this strange request of yours, if you do not explain well what you have to do adding photos I do not understand what you want to do, useless to think about commands that do not exist in kantu think to do what you want to do using the commands currently in kantu.

A solution to get the value can be this

Store current url
remove unused part
save the value in variable
use the variable in your command