In CasperJS can I turn off an event handler => send click event without a resize event
<p>I'm testing a page that has an event handler that reloads the page on resize.
It is interfering with testing, and I would like to turn it off.</p>

<p>On the page, the handler is:</p>

<pre><code>        $(window).bind('resize', function(e) {
            if (window.RT) clearTimeout(window.RT);
            window.RT = setTimeout(function() {
                this.location.reload(false); /* false to get page from cache */
            }, 100);
        });
</code></pre>

<p>So in CasperJS, I tried doing this:</p>

<pre><code>        this.evaluate(function() {
            $(window).unbind('resize');
        });
</code></pre>

<p>No success though. I'd rather turn it off from CasperJS than make changes to the page.</p>

<p>[UPDATE] Although I have been unable to unbind the resize event handler, I managed to send a click from CasperJS/PhantomJS without triggering a resize event. In case this is helpful to you, here is the code for that:</p>

<pre><code>// This is a workaround alternative to this.click(link)
// It does not trigger a resize event. (1 test)
function myclick( test, casper, link ) {
    test.assertExists(link);
    test.comment('myclick: send click event to ' + link);
    casper.evaluate(function(link) {
        var evt = document.createEvent('MouseEvents');
        evt.initEvent('click', true, false);
        document.querySelector(link).dispatchEvent(evt); 
    }, link);
}
</code></pre>

<p>You could call it like this:</p>

<pre><code>        myclick( test, casper, 'a#logout' );
</code></pre>

<p>So now I don't have to disable the resize event handler.</p>