Actinomorphic
6 years agoOccasional Contributor
Script vs Keyword Test with Delphi menu items
This script works fine for checking the expected enabled/disabled state of submenu items.
function Connect_No_Loggers_Check_Menus() { var Process, Window, MainMenu, Submenu, Item; Process = Sys.Process("ConnectScreen"); Window = Process.FormMain; MainMenu = Window.MainMenu; Submenu = MainMenu.Items("File").Submenu; Item = Submenu.Items("Select Server..."); aqObject.CheckProperty(Item,"Enabled",0,true); Item = Submenu.Items("Connect"); aqObject.CheckProperty(Item,"Enabled",0,false); Item = Submenu.Items("Disconnect"); aqObject.CheckProperty(Item,"Enabled",0,false); Item = Submenu.Items("Exit"); aqObject.CheckProperty(Item,"Enabled",0,true); }
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).
Sys.Process("ConnectScreen").VCLObject("FormMain").VCLObject("MainMenu").VCLObject("TMenuItem")
I'm still wrapping my head around what I can do in scripts vs. keyword tests. How can I specify the submenu by name or index and submenu item by name or index that I want to examine in a keyword test?