mardi 30 juin 2015

Protractor click element by repeater

I am trying to click first element from a list <li> by repeater My HTML looks like:

<ul class="list-unstyled" ng-show="axCarSearch.found.length">
                    <!-- ngRepeat: car in axCarSearch.found --><li ng-repeat="car in axCarSearch.found" viewport-check="$index==axCarSearch.current" class="ng-scope">
                        <a class="clearfix current" ng-mousedown="axCarSearch.select(car)" ng-class="{current: $index==axCarSearch.current}">
                            <!-- ngRepeat: m in car.match track by $index --><!-- ngIf: $odd -->
                            <!-- ngIf: $even --><span ng-repeat-end="" ng-if="$even" ng-bind="m" class="ng-binding ng-scope">VW</span><!-- end ngIf: $even --><!-- end ngRepeat: m in car.match track by $index --><!-- ngIf: $odd --><strong ng-repeat-start="m in car.match track by $index" ng-if="$odd" class="text-primary ng-binding ng-scope" ng-bind="m">Passat</strong><!-- end ngIf: $odd -->
                            <!-- ngIf: $even --><!-- end ngRepeat: m in car.match track by $index --><!-- ngIf: $odd -->
                            <!-- ngIf: $even --><span ng-repeat-end="" ng-if="$even" ng-bind="m" class="ng-binding ng-scope">05/07-10/10 (3C)</span><!-- end ngIf: $even --><!-- end ngRepeat: m in car.match track by $index -->
                            <!-- ngIf: !car.match -->
                            <small class="pull-right text-muted ng-binding">Typ</small>
                        </a>
                    </li><!-- end ngRepeat: car in axCarSearch.found --><li ng-repeat="car in axCarSearch.found" viewport-check="$index==axCarSearch.current" class="ng-scope">
                        <a class="clearfix" ng-mousedown="axCarSearch.select(car)" ng-class="{current: $index==axCarSearch.current}">
                            <!-- ngRepeat: m in car.match track by $index --><!-- ngIf: $odd -->
                            <!-- ngIf: $even --><span ng-repeat-end="" ng-if="$even" ng-bind="m" class="ng-binding ng-scope">VW</span><!-- end ngIf: $even --><!-- end ngRepeat: m in car.match track by $index --><!-- ngIf: $odd --><strong ng-repeat-start="m in car.match track by $index" ng-if="$odd" class="text-primary ng-binding ng-scope" ng-bind="m">Passat</strong><!-- end ngIf: $odd -->
                            <!-- ngIf: $even --><!-- end ngRepeat: m in car.match track by $index --><!-- ngIf: $odd -->
                            <!-- ngIf: $even --><span ng-repeat-end="" ng-if="$even" ng-bind="m" class="ng-binding ng-scope">10/00-05/05 (3B3/3B6)</span><!-- end ngIf: $even --><!-- end ngRepeat: m in car.match track by $index -->
                            <!-- ngIf: !car.match -->
                            <small class="pull-right text-muted ng-binding">Typ</small>
                        </a>
                    </li><!-- end ngRepeat: car in axCarSearch.found --><li ng-repeat="car in axCarSearch.found" viewport-check="$index==axCarSearch.current" class="ng-scope">
                        <a class="clearfix" ng-mousedown="axCarSearch.select(car)" ng-class="{current: $index==axCarSearch.current}">
                            <!-- ngRepeat: m in car.match track by $index --><!-- ngIf: $odd -->
                            <!-- ngIf: $even --><span ng-repeat-end="" ng-if="$even" ng-bind="m" class="ng-binding ng-scope">VW</span><!-- end ngIf: $even --><!-- end ngRepeat: m in car.match track by $index --><!-- ngIf: $odd --><strong ng-repeat-start="m in car.match track by $index" ng-if="$odd" class="text-primary ng-binding ng-scope" ng-bind="m">Passat</strong><!-- end ngIf: $odd -->
                            <!-- ngIf: $even --><!-- end ngRepeat: m in car.match track by $index --><!-- ngIf: $odd -->
                            <!-- ngIf: $even --><span ng-repeat-end="" ng-if="$even" ng-bind="m" class="ng-binding ng-scope">10/96-09/00 (3B2/3B5)</span><!-- end ngIf: $even --><!-- end ngRepeat: m in car.match track by $index -->
                            <!-- ngIf: !car.match -->
                            <small class="pull-right text-muted ng-binding">Typ</small>
                        </a>
                    </li>
                </ul>

As you can see its some kind of LIST of cars, where each <li> represent one of them. I basicly try to click one specific (started with first one)

I try to write something like this:

element(by.repeater('car in axCarSearch.found').row(0)).element(by.css('[ng-mousedown="axCarSearch.select(car)"]')).click();

Unfortunately I get an error:

No element found using locator: by.repeater(car in axCarSearch.found").row("0")"

Is there anyone who can help me find a way to click on that <li> please?

Aucun commentaire:

Enregistrer un commentaire