首先,我知道 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
对象的集合:
所以也许是这样的:
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/