I\'ve written a script in vba to parse some information from a webpage. The thing is before scraping any information from that webpage I need to make my scraper scroll downw
Take a look at the below example:
Option Explicit
Sub Test()
' Add references
' Microsoft XML, v6.0
' Microsoft HTML Object Library
Dim sResponse As String
Dim aResult() As String
Dim i As Long
Dim oElement As HTMLDivElement
With New XMLHTTP
.Open "POST", "http://catalogo.marmomac.it/ajax/getListEspositori.php", False
.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"
.Send "start=0&count=5000"
sResponse = .ResponseText
End With
With New HTMLDocument
.body.innerHTML = sResponse
i = 1
For Each oElement In .getElementsByClassName("elemento")
ThisWorkbook.Sheets(1).Cells(i, 1) = oElement.innerText
i = i + 1
Next
End With
End Sub
The output for me as follows, there are 1669 items total: