How to determine if a button is disabled or not in Selenium IDE

I want to check if the button is disabled or not. selenium IDE But I could not. I tried the code below, but it does not work. is there any other way to find if the button is disabled ...? <tr><td>assertElementPresent</td><td>
//button[contains(text(), 'Save')]</td><td>/td></tr>

+7
source share
5 answers

I got the answer as follows. I get all the style classes using "window.document.getElementById (" requiredId ") ClassName" and looking for the desired to disable the style class with the following expression.

 |assertExpression | javascript{storedVars['classname'].search("disabled-style-cl‌​ass") == -1} | false | 
+1
source

In WebDriver. There is an isEnabled method that returns true if the element is enabled, otherwise it returns false.

 driver.findElement(By.id("elementID")).isEnabled(); 
+12
source

You can use VerifyNotEditable to validate your item, a button in this case.

+10
source

You can check the visibility of an element using the assertVisible .

The code:

Command = assertVisible
Target = Locator Value

Returns true if the specified element is visible, false otherwise

Determines whether the specified item is visible. An element can be rendered invisible by setting the CSS visibility property to hidden or the display property to none, either for the element itself or for one if its ancestors. This method will not work if the item is missing.

+1
source

A button can be disabled in many ways ... so you need to think about it, but the assertAttribute command using the disabled attribute is a simple solution.

This ensures that the element has a value of disabled , which is the usual way to disable elements , but not the only way .

+1
source