title: Casperjs thenEvaluate failing on angularjs Application
body: <p>I have a small CasperJS test script as below. The website used in the <code>url</code> is build on angular.</p>
  
  <pre><code>var deals;
  var url;
  var login_url;
  
  casper.test.begin('Paytm test', function(test) {
      casper.start(login_url, function() {
          test.assertExists('form', 'form is found');
          this.fill('form', {
              username: 'username', 
              password:  'password'
          }, true);
      });
  
      casper.then(function(){
          casper.start(url);
  
          casper.waitForSelector(".border-radius.profile1",
          // click login/signup button on home page
          function success() {
              test.assertExists(".border-radius.profile1");
              this.click(".border-radius.profile1");
          },
          function fail() {
              test.assertExists(".border-radius.profile1");
          });
  
          casper.waitForSelector(deals,
          // click on deals
          function success() {
              test.assertExists(deals);
              this.click(deals);
          },
          function fail() {
              test.assertExists(deals);
          });
  
          casper.waitForSelector("selector",
          // select an item from coupons page
          function success() {
              test.assertExists("selector");
              this.click("selector");
          },
          function fail() {
              test.assertExists("selector");
          });
  
          casper.waitForSelector(".discraption button",
          // clicked on buy button
          function success() {
              test.assertExists(".discraption button");
              this.click(".discraption button");
          },
          function fail() {
              test.assertExists(".discraption button");
          });
  
          casper.waitForSelector("#mpCart div div.order-summary.fr &gt; button",
          // clicked on proceed button from cart
          function success() {
              test.assertExists("#mpCart div div.order-summary.fr &gt; button");
              casper.debugHTML("#mpCart div div.order-summary.fr &gt; button");
              console.log('clicked on proceed button');
          },
          function fail() {
              test.assertExists("#mpCart div div.order-summary.fr &gt; button");
          });
  
          casper.thenEvaluate(function(){
              console.log('in then evaluate');
              angular.element(document.querySelectorAll('#mpCart div div.order-summary.fr &gt; button')).triggerHandler('click');
          }, 'CasperJS');
      });
  
      casper.run(function() {
          test.done();
      });
  });
  </code></pre>
  
  <blockquote>
    <p>Every waitforSelector is working fine, but the control is not going into the casper.thenEvaluate function where I want to trigger an angular click event.</p>
  </blockquote>
  
  <p>I have tested the</p>
  
  <pre><code>angular.element(document.querySelectorAll('#mpCart div div.order-summary.fr &gt;   
  button')).triggerHandler('click');
  </code></pre>
  
  <p>It works fine from the firebug console, but not here.</p>
  
  <p>Any help would be really appreciated.</p>