【发布时间】:2021-01-18 22:22:51
【问题描述】:
我正在尝试将一些数据从网站获取到 Excel 中......如果我在 Chrome 中使用 View pagesource 它会显示
<div class="buttons">
<div class="vote" onclick="Vote.cast();" data-tooltip-text="Stem op deze foto">
<div class="container">
<div class="voteIcon">Stem op deze foto!</div>
<div class="votes"></div>
</div>
</div>
</div>
当我检查它时,它会显示
<div class="buttons">
<div class="vote voted" onclick="Vote.cast();" data-tooltip-text="Stem op deze foto">
<div class="container">
<div class="voteIcon">Stem op deze foto!</div>
<div class="votes">2</div>
</div>
</div>
</div>
数字 2(在本例中)是我要提取的文本....但无论我尝试什么,它都只返回一个空字符串。
ActiveWorkbook.ActiveSheet.Cells(i, 2).Value = detailbot.FindElementByClass("votes").text
在我看来应该可以解决问题,但事实并非如此
【问题讨论】:
-
可以分享一下网站的网址吗?
标签: html excel vba selenium web-scraping