vba - 如何打印 Excel VBA 的 Selenium 包装器的 findElements() 的值

标签 vba excel selenium

首先,我知道 findElements() 返回 Selenium 找到的值的列表。我想知道如何在 Excel VBA 中打印每个项目,或者如何在 Selenium 包装语法中打印它?

请参阅下面我的代码。

我收到类似的错误

Object does not support....."

在 msgBox 语法中。

Dim tableElement As WebElement

Set tableElement = driver.FindElementById("picker_address_table_tag")

Dim tableList As New List

Set tableList = tableElement.FindElementById("picker_address_thead").FindElementsByTagName("th")

Dim testString As Variant

testString = tableList.Values()


MsgBox testString(2)

MsgBox testString(3)

MsgBox testString(4)

MsgBox tableList.Count

MsgBox tableList.Item(1).Attribute

最佳答案

您应该获得 IWebElement 对象的集合:

https://selenium.googlecode.com/svn/trunk/docs/api/dotnet/html/AllMembers_T_OpenQA_Selenium_IWebElement.htm

所以也许是这样的:

Dim e
'....
For Each e in tableList
    Debug.Print e.Text 'output innerText
Next e

关于vba - 如何打印 Excel VBA 的 Selenium 包装器的 findElements() 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32322773/

相关文章:

VBA - 查询自定义类的集合

excel - 如果满足条件,则创建数据列表

excel - 使用任务计划程序从 PowerShell 创建电子邮件(运行时错误 429)

excel - 从 Col1 和 Col2 中的文本写入 Col3 中的不匹配数据

vba - AppleScriptTask 抛出错误 5 - 无效的过程调用或参数

java - 有没有办法单击名称为ignorecase的按钮

java - 元素未获得焦点且无法单击

excel - 在类模块内创建公共(public) VB 数组

c# - EPPlus AddPicture 导致 Excel 2007 文件损坏

selenium - Firefox 和最新 Selenium IDE(2.9.1.1 签名)的版本兼容性