I'd like to do the same in a Keyword Test. The problem is that this is a Delphi application, and using the object browser, I cannot drill down all the way to the submenu items. The deepest I can go is to TMenuItem (the submenus).
There are, quite honestly, limtiations in keyword tests. Basically, you can do the same, but I find it cumbersome in keyword tests to build out similar code.
However.... since you have the script code, you CAN call that from a keyword test. There is an operation in keyword tests to run a script routine. It doesn't make any sense to re-invent the wheel... just call your script from your keyword test... in fact, I find this the BETTER way to do things in a team that doesn't have a lot of coding experience... those who can code help write utility functions like this and those who can't code so well incorporate those into the keyword tests. Everyone is happy then. 🙂
Robert Martin [Hall of Fame] Please consider giving a Kudo if I write good stuff ----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group. I love good food, good books, good friends, and good fun.