Contributions
How to check if a specific Item on a MenuItem object exist
I'm handling a MenuItem object, but this menu work with permissions filters and sometimes the option i need to interact isn't presenton screen. To check if that option exist before send the action to the object, i access the Item in the position expected to be my option by the index and getthe Caption property value. If that Caption matches with the option i expect, i send the action (click, selection, ...). I'm looking in the SmartBear Community and Support for other ways, but not succesfully. Anyone canhelp? C#: //Items(4): Position i expect my option, if the user has permission to see it. varexpectedOptionName = "optionX"; var optionText= Menu["PopupMenu"].Items(4).Caption; if(optionText== expectedOptionName) { Menu["PopupMenu"]["Click"](4); } else { Log["Message"]("Option is disabled for this user."); }1.2KViews0likes2CommentsHow to read data from a command prompt window / Reading data from cmd.exe - TC c# script
With cmd.exerunning, the code below returns the users logged in, read the results and record it in the test log. function functionName() { var p, w, txt, cnt, i, s; p = Sys.Process("cmd"); w = p.Window("ConsoleWindowClass", "*"); w.Keys("qwinsta [Enter]"); txt = w.wText; aqString.ListSeparator = "\r\n"; cnt = aqString.GetListLength(txt); for (i = 0; i < cnt; i++) { s = aqString.GetListItem(txt, i); } }1.3KViews0likes1Comment