2

First of all, I know that findElements() returns a list of the values found by Selenium. I would like to know how to print each items in Excel VBA or how it should be printed in Selenium wrapper syntax?

Please see my Code below.

I receive an error something like

Object does not support....."

at the msgBox syntax.

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

1 Answer 1

2

You should get a collection of IWebElement objects:

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

So maybe something like:

Dim e
'....
For Each e in tableList
    Debug.Print e.Text 'output innerText
Next e
Sign up to request clarification or add additional context in comments.

1 Comment

Hi Tim! Thank you very much for the answer. I was able to print out and check the text it outputs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.