Protractor Do not select the first item from the autocomplete search address

I need to select the first element from the autocomplete search box when autocomplete shows its hover to another element, so another element that cannot be processed by the protractor, Solution

element.all (by.css ('[ng-model = "address"]')). get (0) does not work for me, but works on another computer, the same script works on another computer, I checked the protractor version, selenium version
I also try element.all (by.css ('[ng-model = "address" ] ')). first (); its also doesn't work for me, you know how can i get the first item? thank

enter image description here

+4
3

protractor.Key.ENTER

yourelement.sendKeys(' ', protractor.Key.ENTER);

+4

, .

this.selectFirstElement = function(element){
    browser.sleep(3500);
    browser.driver.actions().mouseMove(element);
    element.sendKeys(protractor.Key.ARROW_DOWN);
    element.sendKeys(protractor.Key.TAB);
};
+4

Try adding a short delay (say 500 ms), and then click. Sometimes autocomplete rendering skips the first element.

0
source

All Articles