使用casperJS evaluate自动单击链接

时间:2013-08-19 11:54:09

标签: javascript phantomjs casperjs evaluate

我有以下HTML

    <div class="cart-rem-coupon">
        <span class="rem-icon" onclick="myVoucher.remove('2999','remove_voucher_
button');">&nbsp;</span><a onclick="myVoucher.remove('2999','remove_voucher_link
')" href="javascript:void(0)"><u>Remove Voucher</u></a>
    </div>

我想自动点击

document.getElementsByClassName("rem-icon")[0].click();(这在评估中)

我收到以下错误:

'undefined' is not a function (evaluating 'document.getElementsByClassName ("rem-icon")[0].click()')

任何rason我在哪里做错了?

0 个答案:

没有答案