1
4

4 回答 4

1

您需要像这样直接获取属性:

expect(myelement.getAttribute('disabled')).toBeTruthy();

我每天在量角器测试中使用它,没有问题。

于 2014-12-31T18:05:22.777 回答
0
于 2014-12-31T19:42:14.630 回答
-1
if (dcoument.getElementById("a").disabled) {
    //disabled
} else {
    //active
}
于 2014-12-31T17:59:57.060 回答
-1

您可以简单地使用 jQuery 来确定何时在链接上启用或禁用该属性

$(function() { $('input[type="button"]').on('click',function(){

    if($('a').prop('disabled')){ // checks whenever the element has the given atribute
    alert('it is enabled');
    } else {

    alert('it is not enabled');
    }
    });

http://jsfiddle.net/ukLsxna2/1/

于 2015-01-01T02:42:16.083 回答