Jagdeep Bhatta
Jagdeep Bhatta

Reputation: 31

How to close Drop Down using Protractor

The dropdown block is working fine because, I can see that the element is clicked and the drop down appears with check box type options populated, however after the selection it does not close. I have also attached the HTML snippet of code after the dropdown block is opened below -

enter image description here

The below is the UI screen.

enter image description here

The below is the HTML snippet to the Prefix field: enter image description here

This is the code i am trying with:

element(by.model("requestType.whoCanInitiate")).click();
element.all(by.repeater("user in usersList")).get(3).click();
element(by.model("requestType.icon")).click();
element.all(by.repeater("icon in icons")).get(0).click();
element(by.name("prefix")).sendKeys("admin");

Upvotes: 0

Views: 849

Answers (1)

Majesty
Majesty

Reputation: 1909

I believe that dropdown can be closed by clicking somewhere outside or pressing ESC button, try the following examples

 $('body').sendKeys(protractor.Key.ESCAPE);

or

 $('body').click();

or close by clicking on material backdrop element

 $('md-backdrop').click();

Upvotes: 4

Related Questions