Validating presence of element by index
<p>So I have a page object function that verifies that a particular error appears on the screen. errorMsg is a selector that has already been defined in a var</p>

<pre><code>this.isErrorMessageDisplayed = function() {
        expect(errorMsg.isDisplayed()).to.become(true);
}
</code></pre>

<p>This function works great. However, I keep running into issues when dealing with elements that have multiple.. For instance if this was defined as a $$ and I wanted to validate all occurrences of them, I tried like this..</p>

<pre><code>this.isErrorMessageDisplayed = function() {
        for(i = 0; i &lt; errorMsg.count(); i++){
            expect(errorMsg.get(i).isDisplayed()).to.become(true);
    }
}
</code></pre>

<p>Why does this not work, however whenever there is just one element that I am trying to identify it works great? Thanks for the help!</p>