如何使用vbscript更改div类(html)

时间:2019-04-21 08:10:28

标签: html vbscript bots

我正在编码一个与页面交互的机器人,我需要检查此复选框,而.click函数无法正常工作,所以我发现将类从“ icheckbox_minimal”更改为“ icheckbox_minimal已选中”会更容易” 但是我不知道如何用我的VBS文件更改该类,或者是否有另一种方法可以选中该框?

我尝试了这个,但是没有用 webbrowser.document.all.item(“ order_terms”)。click

这是复选框的代码

<div class="icheckbox_minimal" style="position: relative;">
   <input class="checkbox" type="checkbox" value="1" name="order[terms]" 
   id="order_terms" style="position: absolute; top: -20%; left: -20%; 
   display:block; width: 140%; height: 140%; margin: 0px; padding: 0px; 
   background: rgb(255, 255, 255); border: 0px; opacity: 0;">
   <ins class="iCheck-helper" style="position: absolute; top: -20%; left: 
   -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 
   0px;background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>

我只希望选中此复选框

1 个答案:

答案 0 :(得分:0)

谢谢@mplungjan

我使用了这段代码(全部一行)

webbrowser.document.getElementsByClassName("icheckbox_minimal")(0).className = 
"icheckbox_minimal checked"

成功了