hp-uft

Ignore errors in UFT without generating a warning


On certain pages in my tests I have are-you-sure-popups that my or may not show up. I solve this obvious problem using

On Error Resume Next
[Click OK]

This works fine but for all the popups that have actually not been present but it generates a warning which does look unnecessarily alarming. Is there any way to suppress these warning in UFT?


Solution

  • On Error Resume Next
    Reporter.Filter = rfDisableAll
    Dialog("TITLE").Button("LABEL").Click
    Reporter.Filter = rfEnableAll
    On Error GoTo 0
    

    This is the Hacky Way.

    For a very pure implementation you should be deterministic: always be in control, always know, what will happen and use the Exist Property on the Object if it's optional.

    For Random Events the UFT Solution is Recovery Scenarios - but I did not see many implementations for it.