delito
5 years agoOccasional Contributor
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 is visible for admin
- Testcase 2 - check the same button is not visible for user
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.