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

I need to select the first element from the autocomplete search window 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
source share
3 answers

you can send enter key

protractor.Key.ENTER

yourelement.sendKeys ('your text to send', protractor.Key.ENTER);

+4
source

An autocomplete list is only displayed if the cursor is over an item.

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

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

0
source

Source: https://habr.com/ru/post/1584193/


All Articles