Here is a method to validate if an Aria element is enabled/disabled using xpath in WATIR.
The attributes that Watir provides for identifying the HTML elements on the page such as flash/Aria objects are sometimes not sufficient enough to identify elements on the page. XPath is well established and powerful query language for XML documents.

Lets take an example of aria button as shown below:

Image 1

Image 2

So, as seen in the image, we have Aria button, ‘Cheese’. Here the only attribute that changes when the button is enabled and disabled is “aria-checked” which is “false” when disabled and “true” when enabled”. We can use this attribute as an identifier in xpath watir method.

You can see these aria buttons in action onhttp://developer.yahoo.com/yui/examples/button/button-ariaplugin.html

The WATIR method using xpath is below:

1> To check if the button is enabled:

The above method also uses the attribute, id to differentiate the button, ‘cheese’ from other aria buttons. This method can be called whenever you need to check if the button is enabled.

2>To check if the button is disabled:

Enhanced by Zemanta