Skip to content
Advertisement

isEnabled() method always returns true

I want to get the list of Strings for which the check boxes are enabled. But when i use isEnabled(), it always return true even for the disabled check boxes. And in output i get the list of all Strings present in that field.

Below is the code which i have written for it:-

JavaScript

HTML code is as below:- For Disabled checkboxes:-

JavaScript

for Enabled checkboxes:-

JavaScript

Advertisement

Answer

As your trying to verify the input node is enabled or disabled, isEnabled() checks for the disabled attribute on the element. If the attribute “disabled” is not present, it returns True.

Try the below code:

JavaScript

As you want to check the input node is enabled or not, you need to change your locator a bit because previosly you are try to check the label is enabled/disabled not the input node So you are getting always true.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement