Forum Discussion

TestCoeUs1337's avatar
TestCoeUs1337
Occasional Contributor
4 months ago

Asserting that element does not exist

Im running some tests where sometimes I have to see if something is not on the screen. I use aliases for the element, and if they are there, it finds it super quickly without issues, but when I try to do reverse operation, for example

if (!Aliases.browser.buttonName.exists) {
   Log.Checkpoint(`"${buttonName}" button does not exist`);
} else {
   Log.Error(`"${buttonName}" button does exist`);
}

so not existing is the default behaviour however it seem to be taking 10 seconds everytime the element is not there. Any way I could speed up this process? is it some sort of search being done in the meantime or a timeout I could maybe reduce? 

1 Reply

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    During playback, when an object does not exist, TC is configured to wait for 10 seconds, as shown below.

    To check the property value of an object, the object must exist. I.e. it must be visible in the Object Browser. 

    I suggest you use the Find Method