如何使用 Protractor 从 Google 自动完成建议的列表框中单击第 n 个元素?

How to click nth element from listbox of Google autocomplete suggestion using Protractor?

"get(n)" 无法从 suggestion.It 中获取所需的项目,显示错误 "get is not defined"。 First()、Last() 也没有 work.Please 建议应该做什么?

我的量角器代码:

browser.driver.get('http://www.google.com');
search = browser.driver.findElement(by.css('.gsfi'));
search.sendKeys('Fifa');
searchInsideText = search.getAttribute('value');
searchInsideText.then(console.log);
browser.driver.sleep(2000);
suggestionItems = browser.driver.findElement(by.css('.sbsb_b ')).get(0).getText();
suggestionItems.then(console.log);
Found the solution:

browser.driver.get('http://www.google.com');

search = browser.driver.findElement(by.css('.gsfi'));
search.sendKeys('fifa18');
searchInsideText = search.getAttribute('value');
searchInsideText.then(console.log);

browser.ignoreSynchronization = true;
browser.waitForAngular();
browser.sleep(500);

suggestionItems = element.all(by.css('ul.sbsb_b li')).get(2).getText();
suggestionItems.then(console.log);
suggestionItems.click();