Reputation: 7119
Is there an official way to determine if the input I'm receiving from a function is an ElementFinder
(a single web element) or an ElementArrayFinder
(a collection of web elements).
So far I've got this.
if (_.isFunction(elemOrElems.count)) {
// it's an ElementArrayFinder
}
This seems like it's depending on an API that could easily break in the future.
Upvotes: 2
Views: 200
Reputation: 5703
if you don't want to depend on a method, how about using instanceof?
if(elemOrElems instanceof protractor.ElementFinder){
..
}
Upvotes: 4