Need help to click on button

86 views
Skip to first unread message

casperjs

unread,
Dec 4, 2014, 4:52:21 PM12/4/14
to casp...@googlegroups.com
My html for "Add to cart" look like below:

<div ng-show="item.Allowed=='true' && item.RequiresApproval=='false'" class="">

  <button class="smallbutton" ng-click="addToCart()" ng-disabled="!canAddToCart()">Add to Cart</button>

     </div>


I am using casperjs to click on Add to cart ,please suggest how can we click it.

I used below, but it is not working:

casper.then(function() {

casper.clickLabel('Add to Cart', 'button');

casper.wait(3000);

casper.emit('take.snapshot');

});

Yann P

unread,
Oct 3, 2016, 4:52:02 AM10/3/16
to CasperJS
Hello,

I have the same problem.. do you find a solution ?

Thanks

Yann

philippe....@oscaro.com

unread,
Oct 18, 2016, 4:42:46 AM10/18/16
to CasperJS
Maybe you can try:

casper.then(function() {
   
this.click('.smallbutton');
});


OR

casper.then(function() {
   
this.mouse.click('.smallbutton');
});


OR

casper.then(function() {
   
this.sendKeys('.smallbutton', casper.page.event.key.Enter);
});


( i ) The last one is to send Enter key event on the button.
Reply all
Reply to author
Forward
0 new messages