I have a dropdown which is disabled and I have to verify the same. How can I do it with an assert statement or any other method?

  • Which language binding ? Java ? C# ? J's
    – PDHide
    Commented May 14, 2020 at 13:39
  • What is the purpose of validating the values of a disabled dropdown, given that your users can't use it? Commented May 14, 2020 at 21:02

2 Answers 2


In case isEnabled is not working:

  1. Verify the DOM which may be having some attributes to represent it is disabled
  2. And then use element.getAttribute("attName");

If it doesn't work, you can go with the exception. Try to select a value as mentioned in the above code, surround it with try block and capture the result in your catch block.


You can select the dropdown WebElement this way;

WebElement testDropDown = driver.findElement(By.id("testingDropdown"));  
Select dropdown = new Select(testDropDown);

But to check whether it is disabled, you can use isEnabled();

boolean isEnabledDropDown = driver.findElement(By.xpath("dropdown_xpath")).isEnabled();

Check the isEnabled() documentation

Therefore to assert that;


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.