2

HTML code:

<button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button>

In protractor angular automation, I am trying to click on calendar icon using class but am not able to click. Using ng-click I can click on the icon but I have to do using class. Please help me, I am new to angular protractor.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
nrs
  • 937
  • 3
  • 17
  • 42

1 Answers1

1

The problem is that the classes this button has a "layout-oriented" and it's not a good idea to rely on them. But, if you insist:

element(by.css("button.btn.btn-default.btn-sm.pull-right"));

Probably, the most reliable and readable locator in this case (given what is given) is ng-click:

element(by.css("button[ng-click*=move]"));
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • Hi alecxe, thanks for that example, in my case i tried `element(by.css("button[ng-click*=createWL]"));` but it did'nt click into it ! Here the html code : ` – Emna Ayadi May 14 '16 at 09:48
  • @Emna hey, what do you mean by "didn't click into it" exactly? Do you have a question about the problem already created? Thanks. – alecxe May 15 '16 at 22:05
  • Yes, i have created a question yesterday about it. My problem is that the test is passed and no action is executed (i have tried the options you have suggested to me before) i 'm not sure because it's an icon button if i'm locating it correctly! – Emna Ayadi May 15 '16 at 22:09