下面的 HTML 代码充当工具提示信息,出现在鼠标悬停在链接上。使用 .getelementbyclassname 方法,我无法从页面中获取值“故事和体验”。我猜,在加载时工具提示可见之前,HTML 代码不可用于提取。如何使其可见或提取数据?
我正在使用 EXCEL VBA 来执行此操作。
<div id="ext-comp-1115" class="x-tip rich-tooltip" style="position: absolute; z-index: 25000; visibility: hidden; padding: 3px 0px 5px; width: 323px; left: 131px; top: 168px; display: none;">
<div class="ellipsis">Type: <span class="rich-tooltip-item">Story & Experience</span></div></div></div>
VBA代码:
Dim IE As New InternetExplorer
IE.navigate "https://swym.3ds.com/#post:16884"
IE.Visible = True
Do
DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE
Application.Wait (Now() + TimeValue("00:00:016"))
Dim doc As HTMLDocument
Set doc = IE.document
Dim dd As Variant
dd = doc.getElementsByClassName("ellipsis").tags("span")
MsgBox dd
谢谢