Selenium webdriver how to get the enabled status of an angularjs Li element -


i have following angular.js on page. items being displayed angular.js li items. 1 greyed out other enabled. when use selenium webdriver method .isenabled(), both greyed out , enabled items return "enabled".

the first question how .isenabled() work type of element? q second question is, assuming webdriver won't , need xpath, guess use this:

$x("//li[@class ='ng-scope disabled' , @id='actioncustard']") $x("//li[@class ='ng-scope' , @id='actionrhubarb']") 

the first returns if given id disabled, second if given id enabled, built java method check given id element enabled or disabled. there easier way of doing this?

</li> <li id="actionrhubarb" class="ng-scope" on="deriveinvoketype(action)" ng-switch="" ng-class="{'disabled': false}" ng-repeat="action in getactionlist()">     <!--      ngswitchwhen: link_dynamic     -->     <!--      ngswitchwhen: no_invoke_permission     -->     <!--      ngswitchdefault:      -->     <a class="ng-scope ng-binding" ng-click="doaction(action)" ng-switch-default="" href=""></a> </li> <li id="actioncustard" class="ng-scope disabled" on="deriveinvoketype(action)" ng-switch="" ng-class="{'disabled': true}" ng-repeat="action in getactionlist()">     <!--      ngswitchwhen: link_dynamic     -->     <!--      ngswitchwhen: no_invoke_permission     -->     <!--      ngswitchdefault:      -->     <a class="ng-scope ng-binding" ng-click="doaction(action)" ng-switch-default="" href=""></a> </li>    

the element disabled style pointer-events set none not considered .isenabled(). if it's case evaluate css value returned .getcssvalue:

boolean isenabled = !"none".equals(element.getcssvalue("pointer-events")); 

or piece of javascript:

boolean isenabled = (boolean)((javascriptexecutor)driver).executescript(     "return window.getcomputedstyle(arguments[0], null).getpropertyvalue('pointer-events') === 'none'"     , element); 

you determine state checking presence of class disable, won't guarantee element disabled implemented style.


Comments

Popular posts from this blog

Combining PHP Registration and Login into one class with multiple functions in one PHP file -

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -