How to create a condition in protractor for when an element exists or not

前端 未结 4 1413
孤独总比滥情好
孤独总比滥情好 2020-12-05 07:20

I\'m using Protractor JS. And the site is written in Angular JS.

So I have a toggle switch. And I noticed the value in the toggle switch goes from true to false and

4条回答
  •  佛祖请我去吃肉
    2020-12-05 07:41

    Remember that isDisplayed() returns a promise, you can try with:

    element(anyFinder).isDisplayed().then(function(result) {
        if ( result ) {
            //Whatever if it is true (displayed)
        } else {
            //Whatever if it is false (not displayed)
        }
    });
    

提交回复
热议问题