angularjsautocompleteprotractorgulp-protractorprotractor-net

How to select an element in ng-autocomplete in protractor?


Passing text through

sendKeys("dublin,south Africa");

It is unable to select the first element in autocomplete.


Solution

  • issue resolved.

    this.checkin = function(text,index){
            element( by.css('[ng-click="showMapTextBox2()"]') ).click();
            // element(by.model("location")).sendKeys(text);
            browser.actions()
            .mouseMove(element(by.model("location"))
            .sendKeys(text))
            .perform().then(function(){
            browser.sleep(500);
            // press the down arrow for the autocomplete item we want to choose
            for(i = 0; i < index ; i++){
    
                browser.actions().sendKeys(protractor.Key.ARROW_DOWN).perform();
            }
            browser.sleep(500);
            browser.actions().sendKeys(protractor.Key.ENTER).perform();
          });
            browser.sleep(3000);
        };
    

    spec_test code:

    post_text.checkin("new Delhi, India",1);