ArmandsBruns
12 years agoFrequent Contributor
EvaluateXPath
Hi,
Maybe someone knows if the object exists then everything works, but if the object doesn't exist then displays the following error:
"Microsoft VBScript runtime error
Type mismatch: 'UBound''"
-----------------------------------------------
Function EvaluateXPath_object(page, location, typeID, name)
EvaluateXPath_object = False
Dim Attr
Set Attr = Log.CreateNewAttributes
Attr.Bold = True
Dim object, arr
Sys.Refresh()
Do
counter = counter + 1
Sys.Refresh()
object = location.FindAllChildren(typeID,name,20000, True)
arr = page.EvaluateXPath("(//*[text()='"+name+"'])")
If UBound(arr) >= 0 Then
Set button = arr(0)
EvaluateXPath_object = True
log.Message "Click - '"+name+"'",,, Attr
button.Click
page.Wait
Else
EvaluateXPath_object = False
aqUtils.Delay(3000)
Sys.Refresh()
Log.Message("Doesn't find - '"+name+"'")
End if
Loop Until EvaluateXPath_object = True or counter > 25
End Function
-----------------------------------------------
Regards
Armands
Maybe someone knows if the object exists then everything works, but if the object doesn't exist then displays the following error:
"Microsoft VBScript runtime error
Type mismatch: 'UBound''"
-----------------------------------------------
Function EvaluateXPath_object(page, location, typeID, name)
EvaluateXPath_object = False
Dim Attr
Set Attr = Log.CreateNewAttributes
Attr.Bold = True
Dim object, arr
Sys.Refresh()
Do
counter = counter + 1
Sys.Refresh()
object = location.FindAllChildren(typeID,name,20000, True)
arr = page.EvaluateXPath("(//*[text()='"+name+"'])")
If UBound(arr) >= 0 Then
Set button = arr(0)
EvaluateXPath_object = True
log.Message "Click - '"+name+"'",,, Attr
button.Click
page.Wait
Else
EvaluateXPath_object = False
aqUtils.Delay(3000)
Sys.Refresh()
Log.Message("Doesn't find - '"+name+"'")
End if
Loop Until EvaluateXPath_object = True or counter > 25
End Function
-----------------------------------------------
Regards
Armands