Considering these simple html:
<html>
  <body>
    <h1 id='h1'>hello casperjs</h1>
    <a href='javascript: rmH1()'>remove</a>
    <script>
        function rmH1(){
            document.getElementById('h1').remove();
        }
    </script>
  </body>
</html>
By clicking the a element the h1 element is removed.
And next is my js code written in coffeescript:
casper = require('casper').create()
casper.start 'file:///Users/username/my.html', ->
    @capture 'before.png'
    @evaluate ->
        rmH1()
    @capture 'after.png'
casper.run()
However from the screenshots the h1 element was not removed as well.
How do I correctly call the remote function rmH1()?
 
     
    