Vba代码点击网页的第2页

时间:2017-08-24 07:20:55

标签: vba

我想点击网页的第二页但没有运气。请你帮我解决这个问题。

以下是我要点击的按钮的HTML:

<div class="pgdiv">
<span value="1" class="pgdes">  1</span>
<span value="2" class="pgsel">  2</span>
<span value="3" class="pgsel">  3</span>
<span value="4" class="pgsel">  4</span>
<span value="5" class="pgsel">  5</span>
<span value="6" class="pgsel">  6</span>
<span value="7" class="pgsel">  7</span>
<span value="8" class="pgsel">  8</span>
<span value="9" class="pgsel">  9</span>
<span style="width:72px" value="2" class="pgsel">Next »</span></div>

这是我的VBA代码:

With ie.document
    Set elems = .getElementsByTagName("Span")
    For Each e In elems
        If (e.getAttribute("value") = "2") Then
            e.Click
            Exit For
        End If
    Next e
End With

0 个答案:

没有答案