【发布时间】:2015-09-17 15:59:56
【问题描述】:
我正在致力于将一些数据自动输入到 Intranet 网页中。过去,我曾成功使用此类代码单击复选框,但无法使其在扩展行的加号上工作。下面的代码什么都不做,也不提示错误,代码运行正常。
这是我的代码:
Set div = IE.document.getElementsByTagName("div")
For Each i In div
'showExpand?
If i.id Like "iconShowA*" Then
If i.onclick = "showExpand(*)" Then
i.Click'Click plus sign
v = Replace(i.id, "iconShowA", "")
col.Add v 'store the numeric part
End If
End If
Next i
For Each v In col
Debug.Print v
Next v
相关的 HTML 行是:
(我要点击的内容,其中可能有不同的数字标识符“iconShowA(x)”)
<div id="iconShowA34" class="ui-icon ui-icon-plusthick" onclick="showExpand('34','34')" ;="" style="display: block;"></div>
(我也需要避免点击这些)
<div id="iconShowA_N4" class="ui-icon ui-icon-plusthick" onclick="showExpandSub('4','4')" ;=""></div>
【问题讨论】:
-
那么到底是什么问题呢?你有错误吗?它什么都不做吗?是不是点击了你不想点击的东西?
标签: vba excel internet-explorer ie-automation