首页 > 解决方案 > 如何更改使用 vba 扩展的类名和 aria

问题描述

我尝试使用 vba 更改 html 中的类名和 aria-expended。但我锁定了。

我尝试了下面的代码但失败了,因为我无法理解它的逻辑。

我需要更改为然后 aria-expanded="false" 到 aria-expanded="true"

Sub test()

    Dim IE As Object
    Dim doc As HTMLDocument
    Set IE = CreateObject("Internetexplorer.application")

    IE.Visible = True
    IE.navigate "https://sample/cat.php?taxonomy=category"

    Do While IE.Busy
        Application.Wait DateAdd("s", 1, Now)
    Loop

    Set doc = IE.document


    doc.getElementsByClassName("level-0").getElementsByTagName("td").getElementsByClassName("row-actions").Value = "row-actions visible"
    doc.getElementsByClassName("level-0").getElementsByTagName("td").getElementsByClassName("row-actions visible").getElementsByClassName ("button-link editinline")



Set IE = Nothing
End Sub
<tr class="level-0" id="tag-1">
 <td class="name column-name has-row-actions column-primary" data-colname="Name">
   <div class="row-actions">
     <span class="inline hide-if-no-js">
       <button class="button-link editinline" aria-expanded="false" aria-label="Quick edit “cottage garden” inline" type="button">Quick&nbsp;Edit</button> 
.
.
.


标签: excelvbawai-aria

解决方案


推荐阅读