Forum Discussion
Lage
11 years agoContributor
Hi,
I have a script called Common_PersistentActions with some functions to retry operations...
If the button must exist after being clicked I can recommend you use this code:
'LAGE' Persistent Click until ObjExpected exist
Function Click_UntilObjExpectedExist(ObjToAction, ObjExpected) 'Ensure that the given object exist If (ObjToAction.Exists) Then 'Try to perform Click operation until the ObjExpected exist While (not ObjExpected.Exists) and (i < 5) '5 is the retries for this operation (you can put this in a project variable i = i + 1 ObjToAction.Click 'performing the L.Click WEnd Else 'the ObjToAction don't exist Log.Error "Object not found. " & ObjToAction.FullName End If End Function
If the button must Not Exist after click I recommend you use this other function:
'LAGE' This function perform an action until Obj Not Exist
Function Click_WhileObjExist(ObjToAction)
'Ensure that the given object exist
If (ObjToAction.Exists) Then
'Try to perform some action while the given object Not exist
While (ObjToAction.Exists) and (i < 5) '5 is the retries for this operation (you can put this in a project variable
i = i + 1
ObjToAction.Click 'performing the L.Click
WEnd
Else 'the objtoAction don't exist
Log.Error "Object not found. " & ObjToAction.FullName
End If
End Function
Note Important!: be carefull In the way how pass the objects to this functions. They should be 'Onscreen Object