1

In my application, with respect to user access some elements in drop down will be enabled/disabled.I have to check whether the particular element is disabled or not.

2 Answers 2

3

If the element you're trying to find has a literal "disabled" attribute you're probably looking for someElement.isEnabled() which would return a boolean based on the outcome.

1

Also, you can use XPath to identify the disabled elements in dropdown

Ex:- driver.findElements(By.xpath("//option[@disabled="disabled"]"))

2
  • The above code works perfectly
    – Ranjani
    Commented Feb 20, 2018 at 7:06
  • Cheers...........
    – Sachintha
    Commented Feb 21, 2018 at 4:18

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.