[英]How do i check if element exists by id with Jasmine?
How do i use jasmine to simply check if element exist on the page by id? 我如何使用jasmine来简单地检查页面上是否存在元素?
I went over the matchers , toExist()
not seems to solve this issue. 我走过去的匹配器 , toExist()
不似乎解决了这个问题。
This is what i tried: 这是我试过的:
1. expect(by.id('my-id')).not.toExist();
2. expect($(document)).not.toContain($(#my-id));
can you help? 你能帮我吗?
使用Protractor v1.x(不使用angularjs-jasmine-matchers):
expect(element(by.id('my-id')).isPresent()).toBe(true);
要使用angularjs-jasmine-matchers ,您可以像这样编写测试:
expect('#my-id').not.toExist();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.