0

On the angular site the have the following example of a unit test: http://docs.angularjs.org/api/ng/directive/select (note that you need to click the protractor.js button; there is no direct link to show the unit test code)

here is the snippet of interest:

element.all(by.select('color')).first().click();
element.all(by.css('select[ng-model="color"] option')).first().click();

Is there a way to get an element other than the "first()" when using "element.all()"? I can't seem to find proper documentation on what can be done.

6
  • I might just misunderstand you, but do you just want element.all(...).get(x).click()? Commented Mar 20, 2014 at 20:26
  • Alternatively, you could also add a n-th selector to the query. Again, assuming this is the question. Commented Mar 20, 2014 at 20:30
  • element.all(...).get(x).click() exactly, or whatever the syntax may be for something of the sort Commented Mar 20, 2014 at 20:39
  • Judging by this part of the source exactly that code (get(x)) should work. Did you try it? The documentation of the method also has an example which is exactly what I said above. Commented Mar 20, 2014 at 20:46
  • ok, thanks! Unfortunately i can't set your comments as an answer to the question. I was looking like crazy for that documentation in the angular documentation and searching in google. I didn't know it was a separate library. Commented Mar 21, 2014 at 19:30

1 Answer 1

1

From the comments:

Judging by this part of the source exactly that code (get(x)) should work. Did you try it? The documentation of the method also has an example which is exactly what I said above.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.