首先,我知道findElements()
会返回Selenium找到的值列表。我想知道如何在Excel VBA中打印每个项目或如何在Selenium包装器语法中打印它?
请参阅下面的代码。
我收到类似
的错误对象不支持....."
使用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
答案 0 :(得分:2)
您应该获得IWebElement
个对象的集合:
所以可能是这样的:
Dim e
'....
For Each e in tableList
Debug.Print e.Text 'output innerText
Next e