【发布时间】:2021-12-05 06:10:34
【问题描述】:
我目前正在 VBA 中创建网络自动化。我在单击“div”组件时遇到困难-> 它没有响应任何单击、onclick、mousedown 等。事件。 我能够将 div 组件作为 VBA 中的对象“捕获”,但是当我尝试这些操作时,它没有响应任何操作。还有它的内部组件。
div 对象:
<div tabindex="0" class="SubForm SubForm-up" role="button" aria-pressed="false" style="width: 140px; height: 26px; float: right;">
<input tabindex="-1" role="presentation" style="width: 1px; height: 1px; overflow: hidden; position: absolute; z-index: -1; opacity: 0;" type="text">
<div class="html-face">הגדרות לחשבון מעבר</div>
</div>
我的代码:
Set frmPane = doc.getElementsByClassName("SubForm SubForm-up")(3)
frmPane.onclick = frmPane.onmousedown
frmPane.onclick = frmPane.onmouseup
With frmPane
.Focus
'.setAttribute "display", "block"
'.setAttribute "aria-expanded", "true"
.Click
.onclick = frmPane.onmouseup
.FireEvent "onclick"
.FireEvent "onmouseover"
.FireEvent "onmousedown"
.FireEvent "onmouseup"
.FireEvent "onkeydown"
.FireEvent "onkeypress"
.FireEvent "onkeyup"
' .Blur
End With
Set heshbonMaavarObj = frmPane.getElementsByTagName("input")(0)
With heshbonMaavarObj
.Focus
.Click
.FireEvent "onclick"
.FireEvent "onmouseover"
.FireEvent "onmousedown"
.FireEvent "onmouseup"
.FireEvent "onkeydown"
.FireEvent "onkeypress"
.FireEvent "onkeyup"
'.Blur
End With
Set heshbonMaavarObj = frmPane.getElementsByTagName("div")(0)
With heshbonMaavarObj
.Focus
.Click
.FireEvent "onclick"
.FireEvent "onmouseover"
.FireEvent "onmousedown"
.FireEvent "onmouseup"
.FireEvent "onkeydown"
.FireEvent "onkeypress"
.FireEvent "onkeyup"
'.Blur
End With
【问题讨论】:
-
הגדרות לחשבון מעבר
-
我将 html 代码粘贴在问题和评论中,因为它似乎从问题部分消失了。
标签: html vba internet-explorer automation click