Alternative to: Element Should Be Visible

Hello all,

I am wondering whether there is an alternative to Element Should Be Visible keyword from SeleniumLibrary in the Browser library?

It is a useful keyword to me, as well as some other "Should be"s. Did you replace it in some other way in your own tests?

Thank you and best regards,
J

You can use get element states

2 Likes

As _daryl mentioned:

Get Element States is the keyword you are looking for.

It can not only check for visibility but also its absence (hidden) or if an element is enabled or readonly etc.

Because it “returns” multiple states at the same time, you check if a desired state is contained in the list of returned states.

Get Element States    id=yourelement    contains    visible

Or even more information at the same time:

Get Element States    id=yourelement    contains    visible    enabled    editable

Or the opposite if an element is “hidden”

Get Element States    id=yourelement    contains    hidden

You can also watch the talk from last RoboCon

3 Likes

Thank you very much to both of you. This does the trick indeed!

1 Like