when it is not able to find an object it is not returning correct value
set currentObj = findObject(propertyname)
if (isobject(currentObj ) then
log.Message("button is exist")
log.Message("button does not exist")
found = false
set setobj = utils.CreateStubObject
if propertyname =undefined then
set name1 = windows.Find("Name",propertyname,10)
if name.Exists then
found = true
set setObj = name
if (found = True) and isObject(setObj) then
set findObject = setObj
if it able to find the objects the code works fime and returns correct message but if its not able to find objects it is not returning " log.Message("button does not exist exist")
basically if found is true it sets findobject correctly.if its false it is not setting findObject
in log getting object required(findobject)
not sure where ima going wrong.
Solved! Go to Solution.
Your problem is in your findObject. If it doesn't find the object, then found = false and "false" is not an object.
I think this is a better, more elegant way of doing the same thing... fewer variables and a more direct result.
function findObject(propertyname) if propertyname <> undefined then set name = windows.Find("Name",propertyname,10) end if if name.Exists then set findObject = name else set findObject = Utils.CreateStubObject end if end function
[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.
Mysterious Gremlin Master
Vegas Thrill Rider