TestProject Forum
Powered by leading experts in the test automation community

Continue test as soon as element disappears

Hello!

Scenario: I’m waiting until an element is visbible. Then the element is visible for some time (duration is changing from test to test). As soon es the element disappears I want the step to pass and continue the test.

Now if I use “is invisible?” it’s waiting the whole duration of “Adaptive wait” time until it passes but the element disappears before the Adaptive Time runs out. But as the durration of the visibility of the element differs I cant set the Adaptive Time to a fixed value.

I’m looking forward to any suggestions!

Best regards,
Dennis

Hello & thanks for reaching out.

An easier scenario would be to validate the visibility of another page element that appears after your element disappears, you can add an is visible validation with a long timeout, however it will return immediately if the element is visible, and you will not be required to wait for the entire duration. That is the purpose of the adaptive wait time, to attempt and perform that action for the duration of the time mentioned, and only fail once that timeout is over.

Regardless, the is visible and invisible validations check the css property of the element, and should immediately return if the element appears/disappears.

May I ask if you need to perform some sort of interaction with the invisible element afterwards? Can you share the web page or application you are trying to perform these steps on and detail more about what element you are attempting to validate in order for us to check this?

Unfortunately I can’t share the web page.
No I don’t want to interact with the element afterwards. And this element is the only one which appears and disappears on the web page at that moment, so I can’t wait for visibility of another element.

After the element disappears: If I select the element and click “Find” the element selecotor says, that no match was found but however if I play the step “Is invisible?”, the step once passes when the adaptive time is over. The expected behaviour would be, that the test passes immediately as the element is not visible at the moment.

I have tested the scenario you have described, and it works as expected, see a video here:

I am changing the CSS property for the visibility of the paragraph element with the button click from visible to hidden and vice versa, and then checking if it is visible or not. As you can see, not the entirety of the adaptive wait time is waited before the step passes.

If you are experiencing issues we would be more than glad to schedule a zoom session to try and help you resolve them.

If you have meant in that you want your entire test to pass if the element is not visible, that can be done by creating a short test that checks the “Is invisible” validation, and if the step fails, set the on failure behavior to a recovery test that will contain the rest of your test.

Hello,

thanks a lot for the answer and the effort.

I think there’s a problem on the web page sides. The is invisible is working just fine with other scenarious.
I could resolve the issue with a recovery test. For other elements in my test I can use is invisible.