html - 使用 selenium vba 从网站获取文本的问题
问题描述
我正在尝试将一些数据从网站获取到 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
在我看来应该可以解决问题,但事实并非如此
解决方案
我从未使用过 vba,但我发现了这个问题:https ://github.com/7Gabriel/selenium-vba/issues/126#issuecomment-210692163
似乎detailbot.findElementByClassName("votes").Text
应该返回一个值。
推荐阅读
- mysql - 如何在没有关系的情况下连接两个表,只从一个表中获取一个值并将其粘贴到另一个表中?
- arrays - 在 PowerShell 中有一种方法可以使用字符串的子字符串返回数组的索引
- java - Android Studio - GoogleAPIClient 已弃用修复
- swiftui - SwiftUI 样式更新 onEditChanged 不弹出键盘
- php - 如何在 Laravel 中动态设置 memcached 服务器?
- javascript - 如何在Javascript中的对象中提取数组中的对象?
- r-markdown - 在 R Markdown 中创建两个不同深度的目录
- json - 在 Gatling EL 之外调用 jsonStringify()
- java - 如何在 jdk15 之上运行的 felix (v603) 内的 OSGi 组件中创建 InitialDirContext
- ruby-on-rails - Ruby on Rails 中的版本控制 API 助手