I recently tried to locate an element.

I was unable to identify an xpath and after putting a list in a loop. I noticed that for some elements isDisplayed() returned false, but isEnabled() true. How is it possible?

Could it be that the element was hidden somewhere on the background, but still enabled?

By the way, in my perception "enabled" is when you can bring it under focus, right? And also, for all elements where isDisplayed() returned false, isSelected() also returned false.

Am I right that if isDisplayed() returns false, isSelected() can never return true and it can only return true if isEnabled() returns true?

1 Answer 1


No, enabled means that it's not disabled (by means of the disabled attribute or similar). Of course, any element that is enabled may or may not be visible (which is governed by the CSS Display style). Per the JAVA documentation for isEnabled:

Is the element currently enabled or not? This will generally return true for everything but disabled input elements.

If you want a combination of both visible and enabled, use the ExpectedCondition elementToBeClickable

For isSelected, the documentation says the following. So if you have asked this property on other elements, you should always get the same value.

Determine whether or not this element is selected or not. This operation only applies to input elements such as checkboxes, options in a select and radio buttons.

Also, you can have hidden dropdowns where a (default) value has been selected. So pretty much any combination of these three properties is possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.