Loop that will select all elements in a dropdownlist
<p>I went in and created id tags for each dropdown. I tried creating a loop to select each manufacturer in the drop down without having to write 300+ lines of code since there are many options in some of the dropdowns. I tried and couldn't figure out a way. The second drop down for example is "source_manufacturer". </p>

<p>This is what i tried:</p>

<pre><code>var expected = ['COMFORT-AIRE', 'Daewoo', 'GE'];
var els = element.all(by.id('source_manufacturer'));
for (var i = 0; i &lt; expected.length; ++i) {
expect(els.get(i).getText()).toEqual(expected[i]);
}
</code></pre>

<p>Here is the html code:</p>

<pre><code>&lt;select id="source_manufacturer" ng-class="{'btn btn-default' :   !$root.isMobile.iOS()}" class="form-control ng-valid btn btn-default ng-not-empty ng-touched ng-dirty ng-valid-parse" ng-model="manufacturer" ng-options="m.name for m in manufacturers"&gt;

`&lt;option selected="selected" value="object:439" label="COMFORT-AIRE"&gt;COMFORT-AIRE&lt;/option&gt;  
....
&lt;option value="object:443" label="Whirlpool"&gt;Whirlpool&lt;/option&gt;&lt;/select&gt;`
</code></pre>

<p>This is the error message: Failed: Index out of bound. Trying to access element at index: 1, but there are only 1 elements that match locator By(css selector, *[id="source_manufacturer"]). I want to test if each one can be selected and that it actually changes. </p>

<p>The expected shows every element in the list instead of a single one.</p>

<p>This is how i would go about clicking each individual element in the list: </p>

<pre><code>    element(by.id('source_manufacturer')).click().
    element(by.cssContainingText('option', 'GE')).click();
</code></pre>