admin管理员组文章数量:1023856
I want to check if a disabled
attribute is not present on a button
using NightwatchJS.
I tried doing these:
.assert.attributeContains('.phone-verify-btn', 'disabled', 'null')
.assert.attributeContains('.phone-verify-btn', 'disabled', null)
.assert.attributeContains('.phone-verify-btn', 'disabled', 'false')
.assert.attributeContains('.phone-verify-btn', 'disabled', false)
But these don't seem to work like they do to check if disabled
is set to true
like so:
.assert.attributeContains('.phone-verify-btn', 'disabled', 'true')
This works just fine! Any idea what's happening here? The error I get is rather cryptic:
Element does not have a disabled attribute. - expected "null" but got: null
I want to check if a disabled
attribute is not present on a button
using NightwatchJS.
I tried doing these:
.assert.attributeContains('.phone-verify-btn', 'disabled', 'null')
.assert.attributeContains('.phone-verify-btn', 'disabled', null)
.assert.attributeContains('.phone-verify-btn', 'disabled', 'false')
.assert.attributeContains('.phone-verify-btn', 'disabled', false)
But these don't seem to work like they do to check if disabled
is set to true
like so:
.assert.attributeContains('.phone-verify-btn', 'disabled', 'true')
This works just fine! Any idea what's happening here? The error I get is rather cryptic:
Element does not have a disabled attribute. - expected "null" but got: null
-
I have the exact same problem. What I'm currently doing is
.assert.elementNotPresent('.phone-verify-btn[disabled]')
, but I also would like a cleaner solution. – Adam Zerner Commented Aug 6, 2018 at 0:14
2 Answers
Reset to default 2In this case,I think you should get attribute first until we have better solution. This one works for me :
Browser.getAttribute('@element','disabled',function(result){
if(result.value === 'true'){
// element is disabled , do what you want
}
// element not disabled .
})
Perhaps it is not really logical !
Change attributeContains to attributeEquals
.assert.attributeEquals('.phone-verify-btn', 'disabled', null)
I want to check if a disabled
attribute is not present on a button
using NightwatchJS.
I tried doing these:
.assert.attributeContains('.phone-verify-btn', 'disabled', 'null')
.assert.attributeContains('.phone-verify-btn', 'disabled', null)
.assert.attributeContains('.phone-verify-btn', 'disabled', 'false')
.assert.attributeContains('.phone-verify-btn', 'disabled', false)
But these don't seem to work like they do to check if disabled
is set to true
like so:
.assert.attributeContains('.phone-verify-btn', 'disabled', 'true')
This works just fine! Any idea what's happening here? The error I get is rather cryptic:
Element does not have a disabled attribute. - expected "null" but got: null
I want to check if a disabled
attribute is not present on a button
using NightwatchJS.
I tried doing these:
.assert.attributeContains('.phone-verify-btn', 'disabled', 'null')
.assert.attributeContains('.phone-verify-btn', 'disabled', null)
.assert.attributeContains('.phone-verify-btn', 'disabled', 'false')
.assert.attributeContains('.phone-verify-btn', 'disabled', false)
But these don't seem to work like they do to check if disabled
is set to true
like so:
.assert.attributeContains('.phone-verify-btn', 'disabled', 'true')
This works just fine! Any idea what's happening here? The error I get is rather cryptic:
Element does not have a disabled attribute. - expected "null" but got: null
-
I have the exact same problem. What I'm currently doing is
.assert.elementNotPresent('.phone-verify-btn[disabled]')
, but I also would like a cleaner solution. – Adam Zerner Commented Aug 6, 2018 at 0:14
2 Answers
Reset to default 2In this case,I think you should get attribute first until we have better solution. This one works for me :
Browser.getAttribute('@element','disabled',function(result){
if(result.value === 'true'){
// element is disabled , do what you want
}
// element not disabled .
})
Perhaps it is not really logical !
Change attributeContains to attributeEquals
.assert.attributeEquals('.phone-verify-btn', 'disabled', null)
本文标签: javascriptNightwatchJS How to check if attribute is not presentStack Overflow
版权声明:本文标题:javascript - NightwatchJS: How to check if attribute is not present? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745555021a2155822.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论