Protractor and dropdowns with autocomplete

Commonly dropdowns that can be overly long, implement an “as-you-type” filter. This presents an issue, insofar as actual buttons need to be pressed to action the auto-completion.

this.Given(/^I select (.*) from (.*)$/, function (selection, dropdown) {
// click on dropdown field to initiate dropdown
element(by.css('.dropdown')).click().then(function () {
var dropdownField = element(;
//clear the as-you-type field if already populated
dropdownField.clear().then(function () {
// enter text to search dropdown values
sendKeys(dropdownField, selection);
// click TAB button to exit (populated) field
return dropdownField.sendKeys(protractor.Key.TAB);

No Comments

You can leave the first : )