Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get protractor to click my button? I keep getting an element is not visible [duplicate]

I have the following markup, and I am trying to access the <button />

<ul class="flower-list">
  <li ng-repeat="flower in model.flowers">
    <img ng-src="flower.imgUrl">
    <button ng-click="model.addToFlowerPot(flower)">Add</button>
  </li>
</ul>

I have the following:

var flower = element.all(by.repeater('flower in model.flower')).first();
var addButton = flower.element(by.buttonText("Add"));
addButton.click();
like image 382
user1354934 Avatar asked Dec 28 '25 09:12

user1354934


1 Answers

Check if there is a delay if the data is coming from service. You can wait until you get the data with

browser.waitForAngular()

like image 185
v0d1ch Avatar answered Dec 30 '25 23:12

v0d1ch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!