Option Explicit
Sub VBAWebscraping2()
Dim IEObject As Object
Set IEObject = New InternetExplorer
IEObject.Visible = True
IEObject.navigate url:="https://streeteasy.com/building/" & Cells(2, 4).Value
Do While IEObject.Busy = True Or IEObject.readyState <> READYSTATE_COMPLETE
Application.Wait Now + TimeValue("00:00:01")
Loop
Dim IEDocument As HTMLDocument
Set IEDocument = IEObject.document
'GRAB by classname'
Dim IEElements As IHTMLElementCollection
Dim IEElement As IHTMLElement
Set IEElements = IEDocument.getElementsByClassName("details")
For Each IEElement In IEElements
If IEElement.innerText = "price" Then
Debug.Print (IEElement.innerText)
End If
Exit For
Next
'Dim lastRow As Long
'lastRow = Range("A" & Rows.count).End(xlUp).row
End Sub
I am experiencing issues trying to extract the price accurately from the desired location on the website. The tutorials suggest using id tags for precision, but they are lacking on the target site.
The specific page I am attempting to scrape is found at
In addition to the price, I am also aiming to retrieve information about the number of rooms, baths, and the neighborhood.