Reputation: 5762
i am using some kind of angular filter of a table and i need to verify if results from filter is correct.
I already work with this table before, where I click on element:
element.all(by.xpath('.//td[.="89" and @class="ultranarrow ng-binding"]')).click();
this basicly click on element where <td>
have value 89. I need to verify that this number is still there after I enter for example number 8 to filter So i write this:
expect(element.all(by.xpath('.//td[.="89" and @class="ultranarrow ng-binding"]')).isPresent()).toBe(true);
Unfortunately I get an error:
Object [object Object] has no method 'isPresent'
I didn't find any other method how to verify if something exist, is there some problem in syntax or is there any other method which can replace isPresent?
Upvotes: 0
Views: 2058
Reputation: 3691
isPresent
is available only for ElementFinder
, not for ElementArrayFinder
, so you should not call it after you've used all
:
expect(element(by.xpath('.//td[.="89" and @class="ultranarrow ng-binding"]')).isPresent()).toBe(true);
If you really want to use all
, try with count()
instead:
expect(element.all(by.xpath('.//td[.="89" and @class="ultranarrow ng-binding"]')).count()).toBe(1);
Upvotes: 4
Reputation: 49
I am not sure but i think u cannot have element.all(by.xpath(''));
so you can try::::
expect(element(by.xpath('.//td[.="89" and @class="ultranarrow ng-binding"]')).isPresent()).toBe(true);
or choose different locator
expect(element.all(by.css('td[class="ultranarrow ng-binding"]')).isPresent()).toBe(true);
Upvotes: 1