Forum Discussion

delito's avatar
delito
Occasional Contributor
4 years ago
Solved

Best way to test if an element doesnt exist

Hi   What is the best way to test if an element doesn't exist in Test Complete?   I dont have any sample code to share, but here is a business requirement scenario: Testcase 1 - check a button ...
  • jr348's avatar
    jr348
    4 years ago

    Exists is the only property that does not fail if not found.

     

    Another trick I use is adding the "VisibleOnScreen" property to the name mapping of the object so that it does not exist until its actually usable on screen.  Also the "Enabled" property but my particular application this can be unreliable.

     

    Another thing to watch out for is the time-outs on negative tests.  If the Project Default is applied you could be waiting a while for a test to pass.  I use 500-1000ms typically but this depends on the application/environment.