How do I click an element in PhantomJS?
page.evaluate(function() {
document.getElementById(\'idButtonSpan\').click();
});
This gives
Hope the following method will be useful. It worked for me in version 1.9
page.evaluate(function(){
var a = document.getElementById("spr-sign-in-btn-standard");
var e = document.createEvent('MouseEvents');
e.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
a.dispatchEvent(e);
waitforload = true;
});
This worked for me. Hope this will be useful for others also