Can't click button in angular app using angular e2e testing
This is the test case I have:
describe('Checkout flow testing', function () {
it('Testing Checkout',function(){
console.log('navigating to product page');
browser().navigateTo("/product/test-product5")
element(':button.add-cart').click();
sleep(2);
})
})
And the button template looks like this:
<!--
<button data-ng-if="product.available" class="ms-mb-xs btn btn-lg btn-primary add-cart"
id="add_to_cart" data-ng-click="check_required_options(product,data1.quantity)"
title="Add to Cart"><i class="fa fa-shopping-cart"></i> {{Add to Cart}} <button>
+3
source to share
1 answer
Have you specified your item correctly? Try this way:
element(by.css('.add-cart')).click();
Here https://angular.github.io/protractor/#/locators you can find more about locators in Protractor.
+1
source to share