excel - 如何更改使用 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 Edit</button>
.
.
.
解决方案
推荐阅读
- sql - 上一季度的最后一天减去 1 年或 2 年
- oracle - 如何在 PL/SQL Developer 中检索和增加指纹分数?
- ios - 我的应用程序如何打开 Siri 快捷方式记录短语视图
- python-2.7 - 如何使用 api.onchange 返回字典值
- java - Java如何在同一目录中创建多个文件夹
- c - 避免文件中的空白
- android - 在 kitkat android 上找不到处理 Intent { act=android.intent.action.OPEN_DOCUMENT_TREE cat=[android.intent.category.DEFAULT] } 的活动
- h2o - 运行 h2o.save_model 保存模型时的文件格式是什么?
- java - 之前使用过缓存目录
- dpdk - 在 DPDK 的多个核心中应用 ip 分片的正确方法