Skip to content

11 Complex Elements

Biswajit Sundara edited this page Feb 25, 2021 · 1 revision

Auto Complete

When we enter text, then we need to select from the suggested drop down and this needs to be done using Action class.

describe('Protractor Practice Project', function () {
    it('Auto Complete', function () {
        browser.get('https://material.angular.io/components/autocomplete/examples');
        element(by.id('mat-input-1')).sendKeys('Shel');
        browser.actions().mouseMove(element(by.css("#mat-option-4 > span"))).click().perform().then(()=>{
            browser.sleep(4000);
        })
    });
});

Similarly we can have keyup, keydown, double click, right click, drag and drop etc.

Clone this wiki locally