jamescooper
Well-known Member
- Joined
- Sep 8, 2014
- Messages
- 840
Hello,
Bit of a novice on pulling data from the web.
The 3 lines in bold below work. But when I try to pull another element, ret(4), the code isn't working.
How do I work out whether it is a class or attribute?
Many thanks.
Bit of a novice on pulling data from the web.
The 3 lines in bold below work. But when I try to pull another element, ret(4), the code isn't working.
How do I work out whether it is a class or attribute?
Many thanks.
Code:
Private Function getprices(ByVal URL As String) As Variant
Dim source As Object
Dim http As New XMLHTTP60, html As New HTMLDocument
Dim ret(1 To 4) As String
With http
.Open "GET", URL, False
.send
html.body.innerHTML = .responseText
End With
[B] ret(1) = html.querySelector(".price-details--wrapper .value").innerText[/B]
[B] ret(2) = html.querySelector(".price-per-quantity-weight .value").innerText[/B]
[B] ret(3) = html.querySelector(".price-per-quantity-weight .weight").innerText[/B]
' ret(4) = html.querySelector(".promotions-wrapper hidden-medium .offer-text").innerText
getprices = ret
End Function