3

I'm trying to use protractor to implement some e2e tests. I'd like to simulate user interaction with the autocomplete typeaheaded control. I can't find a way to select (click) one element from the autocomplete list. Some suggestions?

I'm using AngularJSv1.3.3 and Bootstrap v3.3.0.

Lemmy
  • 2,437
  • 1
  • 22
  • 30
jojo
  • 160
  • 2
  • 10
  • 1
    try doing it using keyboard keys. You may get some help from here http://stackoverflow.com/questions/28410273/how-to-send-keyboard-keys-in-protractor-like-tab – Priyanshu Mar 10 '15 at 12:03
  • Thank you. Sending a TAB helped, because I need to select exactly the first element in the list, but I'd like to be able to select whatever element in the list. – jojo Mar 10 '15 at 13:29
  • @jojo could you provide a reproduceable example or a link with a similar autocompletion? Thanks. – alecxe Mar 10 '15 at 15:52
  • This is the link to the [autocomplete](http://angular-ui.github.io/bootstrap/#/typeahead) and the way I use it: – jojo Mar 11 '15 at 14:59

1 Answers1

0

This worked for me:

// type into the typeahead
element(by.model('job')).sendKeys('123');

// uib-typeahead uses match in matches...  
element.all(by.repeater('match in matches')).get(0).click();
bwobbones
  • 2,398
  • 3
  • 23
  • 32