I don’t know if this is something that others can use but I find it very useful when writing reusable automated steps.
I’m sure there are several ways to write it but here is one way that I thought of.
Code: Select all
// takes a string containing a multi-level object, such as "MyPage.MyFrame.SomeButton" and returns an AppObject
// that refers to the actual object
AppObject GetActualObject(String sObject)
[ ] List<String> lsObjHierarchy = sObject.Split(".")
[ ] AppObject aObject
[ ] AppObject wWindow
[ ] Integer iIndex = 1
[ ] String sCurObjPart
[ ]
[ ] sCurObjPart = lsObjHierarchy[1]
[ ] wWindow = $(sCurObjPart) // starts with the topmost parent object
[+] for (Integer iCount = 2 ;iCount <= lsObjHierarchy.Count(); iCount++)
[ ] sCurObjPart = lsObjHierarchy[iCount]
[ ] wWindow = wWindow.$(sCurObjPart)
[] return wWindow