我正在尝试选择按钮并检查是否添加了“已禁用”属性。
代码:
expect(audiencePage.saveAudienceBtn.getAttribute('disabled')).toBe(true);
这是有趣的错误:
-Expected 'true' to be true.
Executed 7 of 7 specs (1 FAILED) in 18 secs.
[13:44:18] I/launcher - 0 instance(s) of WebDriver still running
[13:44:18] I/launcher - chrome #01 failed 1 test(s)
[13:44:18] I/launcher - overall: 1 failed spec(s)
[13:44:18] E/launcher - Process exited with error code 1
任何想法,为什么我会收到此错误?
答案 0 :(得分:1)
更改此
expect(audiencePage.saveAudienceBtn.getAttribute('disabled')).toBe(true);
到expect(audiencePage.saveAudienceBtn.getAttribute('disabled')).toBe('true');
错误的原因是你试图比较布尔值和字符串。