While writing a code many time any of them get failed. How actually those methods work? Please great if you can help to stop confusing between those two.
Q - What is the real difference between methods isDisplayed()
and isEnabled()
?
The methods .isDisplayed()
and .isEnabled()
have nothing in common.
Method .isDisplayed()
:
An element is considered displayed when it is perceptually visible to the human eye.
https://www.w3.org/TR/webdriver/#element-displayedness
Method .isEnabled()
:
An element is considered enabled if it's not a form control (button, input, textarea, select or option) or when the user interactions and focus are not blocked with the disabled
attribute/property.
https://www.w3.org/TR/webdriver/#is-element-enabled
For the default implementation:
https://github.com/SeleniumHQ/selenium/blob/master/javascript/atoms/dom.js