PhantomJS; click an element

前端 未结 11 841
借酒劲吻你
借酒劲吻你 2020-11-21 23:53

How do I click an element in PhantomJS?

page.evaluate(function() {
    document.getElementById(\'idButtonSpan\').click();  
});

This gives

11条回答
  •  既然无缘
    2020-11-22 00:23

    For those using JQuery, the JQuery UI created a utility to simulate these: jquery-simulate. I use this in PhantomJS and Chrome

    $ele..simulate( "click" );
    

提交回复
热议问题