1
<select id="cbCategory" ui-select2 name="cbCategory" ng-model="categoryCombo.category" 
        class="show-tick form-control comboBlue" ng-change="loadPrice()" required>
    <option ng-repeat="category in Categories" value="{{category}}" 
            {{category.Name}}</option>
</select>

When I have select like this, without the ng-change, it works in this both solutions:

1. element.all(by.repeater('category in Categories').row(0)).click();

2. element(by.id("cbCategory")).sendKeys('Category1');

But when I have ng-change in my select, both solutions are not working.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195

1 Answers1

0

Click the select before clicking an option, e.g.:

var selectElement = element(by.id("cbCategory"));
selectElement.click();

var option = selectElement.all(by.tagName("option")).first();
option.click();

You may also want to make working with select->option easier by making an abstraction, see:

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • I tried that and it didn't worked, but on github-protractor issues i got correct answer. [link] (https://github.com/angular/protractor/issues/2137) It had something to do with loadPrice(). Anyway tnx, best regards – user3563646 May 14 '15 at 09:23