How to get IsSupported to return False for stub objects?
Like the title says, I would like to have the IsSupported method (or some similar method) to return False when a stub object does not have a given property. The reason for this is we are trying to verify whether an Alias exists in our name mapping. Using the IsSupported method seems to work, up until we start dealing with stub objects (the objects are not in the object tree, but are in our name mapping file).
I realize this is more of a feature request, so my reason for posting here is to just try and find a different way of doing this.
Here is the script we are working with. This script works as long as "currObj" exists in the object tree. We get the error message that we want. The error message does not get posted, though, if we try running the function without our browser open. Every object becomes a stub object, which causes the IsSupported method to return True for everything.
Function Validate 'Good alias 'name = "Aliases.Browser.Page.Section.Field" 'Bad alias name = "Aliases.Browser.Page.Field" arr = split(name, ".") If arr(0) <> "Aliases" Then Log.Error "Error. This is not an alias: " & name Exit Function End If objName = "Aliases." & arr(1) Set currObj = Eval(objName) For i = 1 to UBound(arr) - 1 If aqObject.IsSupported(currObj, arr(i + 1)) Then 'This always returns True for stub objects Log.Message "is supported" objName = objName & "." & arr(i + 1) Set currObj = Eval(objName) Else Log.Error "Aliases name does not exist." Exit Function End If Next End Function
Is there any way to get IsSupported to return false for stub objects? Is there a different method we can use that would mimic this functionality?
Jack,
IsSupported = True for stub objects is by design and documented.
jack_edwards wrote:
The simplest solution, we think, is to just modify the script to work around the Auto-wait timeout.
Yes, that's probably the best way to handle this. Set Options.Run.Timeout to 0 at the beginning of your validation function, and restore the initial value at the end.