According to the documentation, there are 2 ways to get how many elements are inside the ElementArrayFinder (the result of element.all() call):
$$(".myclass").lengthNeed to resolve the promise to get the length of element correctly.
// WORK
$$(".myclass").then(function(items){
items.length;
});
// DOES NOT WORK
$$(".myclass").length;
$$(".myclass").count()A wrapper for $$('.myclass').length which being a promise itself and doesn't require to resolve promise like .length
$$(".myclass").count();
which one should be preferred?
Unless there some complex business when locating $$(".myclass") and .then(function(items){...}) involved then items.length will give better performance.
Otherwise $$(".myclass").count() should always be used.