我在页面上有以下angular.js
。正在显示的项目是angular.js
Li
项目。一个是灰色的,另一个是启用的。当我使用Selenium webdriver
方法.isEnabled()
时,灰色和启用的项目均返回“已启用”。Selenium webdriver如何获取angularjs Li元素的启用状态
第一个问题是我如何获得.isEnabled()
以处理这种类型的元素? Q 第二个问题是,假设的webdriver不会做它,我需要xpath
,我想我可以使用这样的:
$x("//li[@class ='ng-scope disabled' and @id='actionCUSTARD']")
$x("//li[@class ='ng-scope' and @id='actionRHUBARB']")
第一个返回的东西只有在给定的ID被禁用,仅当给定的Id被启用时才是第二,这可以被构建到Java方法中以检查对于给定的id该元素是被启用还是被禁用。有没有更简单的方法来做到这一点?
</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>