FluentAutomation icon indicating copy to clipboard operation
FluentAutomation copied to clipboard

A way to check if element exists/visible (bool)

Open vorou opened this issue 10 years ago • 2 comments

Am I right there's no way to just ask if there an element? Both Expect/Assert and Find just throws when they can't find the element. It's OK when you want to describe test success condition, but in my case I want the test logic to be different, depending on the state of the page (namely, I want to execute login only if user isn't logged in yet).

vorou avatar Jul 01 '14 08:07 vorou

My solution to this problem was to create an extension method to IActionSyntaxProvider called Exists that calls Find and catches the exception to determine if it exists. Then it can return true or false to indicate whether the element exists.

predeekc avatar Oct 28 '14 21:10 predeekc

@predeekc thanks for the solution. It feels like it's more a workaround, though.

vorou avatar Oct 29 '14 03:10 vorou