Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
38
rated 0 times [  44] [ 6]  / answers: 1 / hits: 51492  / 10 Years ago, thu, august 14, 2014, 12:00:00

I have a setting in my angular based website that turns a dropdown on and off. If it is off, then it does not show on the main page.



With Protractor, I need to check to see if this element is not present when the switch is off. However, I should not be thrown into Element Not Found Error, as it is one test in a set of many. How should I do this?



I have tried to do:



expect($$('.switch').count()).to.equal(0).and.notify(next);


But I am getting an AssertionError with this...


More From » angularjs

 Answers
23

Got the thing working by using something I found in the docs:



expect(element(by.css('.switch')).isPresent()).to.become(false).and.notify(next);


Also uses assertions, so it doesn't break cucumberjs.


[#69774] Wednesday, August 13, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jeffn

Total Points: 559
Total Questions: 81
Total Answers: 103

Location: Spain
Member since Thu, Dec 23, 2021
2 Years ago
;