Open GoogleCodeExporter opened 9 years ago
Basically, I am trying here to get article1 from this html:
<span autoid="_lv_5" class="classname1">article1</span>
<span autoid="_lv_5" class="classname1">article2</span>
<span autoid="_lv_5" class="classname1">article3</span>
Original comment by alam...@gmail.com
on 19 Dec 2014 at 3:42
> document.getElementsByClassName('classname1')[0].innerText
Incorrect: In VBA the square brackets are only used to select a range:
Sheets(1).[A1]
> Range("A5") = driver.findElementByClassName("classname1")(0).Text
Incorrect: You are trying to get an item from a collection but the
findElementByClassName returns a WebElement and not a collection
A correct syntax would be:
Debug.Print driver.findElementByClassName("classname1").Text
Or
Debug.Print driver.getElementsByClassName("classname1")(0).Text
Or
Debug.Print driver.getElementsByClassName("classname1").Item(0).Text
Or
For Each e In driver.getElementsByClassName("classname1")
Debug.Print e.Text
Next
Original comment by florentbr
on 19 Dec 2014 at 6:57
Original issue reported on code.google.com by
alam...@gmail.com
on 19 Dec 2014 at 3:38Attachments: