PhantomJS; click an element

前端 未结 11 840
借酒劲吻你
借酒劲吻你 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:21

    use simple JavaScript with evaluate, something like this:

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

提交回复
热议问题