【问题标题】:Determining if HTML Button is Disabled in IE确定是否在 IE 中禁用了 HTML 按钮
【发布时间】:2018-03-16 21:51:32
【问题描述】:

我最近正在做一些 VBA 工作,如果启用,我需要检查网页以单击按钮,如果禁用则不要单击。

但是!我不知道如何让 VBA 检查禁用的按钮。

这里是按钮代码:

<input name="formAction:proxima" title=">" disabled="disabled" class="button" id="FormAction:proxima" type="submite" value=">">

我尝试了一些If,但没有成功

    Set nxt = IE.document.getElementById("formAction:proxima")

    If nxt Is Nothing Then
        IE.Quit
    Else
        nxt.Click
    End If

【问题讨论】:

    标签: html vba excel internet-explorer


    【解决方案1】:

    您也可以使用.disabled 属性(布尔值)

    Dim nxt As HTMLButtonElement
    Set nxt = IE.document.getElementById("formAction:proxima")
    
    If nxt.disabled Then
        ie.Quit
    Else
        nxt.Click
    End If
    

    【讨论】:

      【解决方案2】:

      您需要访问按钮disabled 属性。试试这个:

      Set nxt = IE.document.getElementById("formAction:proxima")
      
      If nxt.getAttribute("disabled") = "disabled" Then
           IE.Quit
      Else
           nxt.Click
      End If
      

      【讨论】:

        猜你喜欢
        • 2016-12-28
        • 2015-10-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多