Occasionally we get complaints that the WaitForVisible steps in Test Studio don't work correctly. Our response is "It's not our fault!"


Here's what I mean:

the Visibility check relies on the Computed Style of the element as seen through the lens of the browser. Specifically we look at the Display property. Here's a video of me using the Google Developer tool to determine the visibility property of an HTML element.

Display:none means element is not visible. So it might be that your browser of choice is not very good at determining the visibility factor. Personally I recommend that you refrain from using WaitForVisible/VerifyIsVisible.

The idea behind the Visibility check is that some element may exist in the DOM structure of the page without actually being visually present on the page as rendered by a browser.

In practice 98% of the time when our customer use the Visibility check the element is simple not present on the page in any form. It doesn't exist on the page. So you're better off using a WaitForExist verification. It's counterproductive to use WaitFor/Verify IsVisible.

Especially if you're using the Verification as condition for an IF/ELSE logical operators. If you attempt to do VerifyIsVisible on an element that doesn't exist on the page - it will fail your test even if it's part of an IF/ELSE statement. So just use WaitForExists first.


Comments are disabled in preview mode.