After some days of research, I've found that other tools outside Excel/VBA use XHTML to be able to use Xpath.
Selenium is not an option since for security reasons is not allowed to install programs (.exe), then I was
wondering if somebody knows if there is a microsoft library or how to convert from the HTML response in code below in line htmlDoc.body.innerHTML = .responseText
to XHTML to be able to use Xpath expressions with SelectNodes() like in line Set elements = xhtmlDoc.SelectNodes("//body/div/div/div]")
Sub Html2Xhtml()
Dim htmlDoc As New HTMLDocument
Dim elements As MSXML2.IXMLDOMNodeList
Dim url as String
url = "https://www.example.com"
With New ServerXMLHTTP60
.Open "Get", url, False
.send
htmlDoc.body.innerHTML = .responseText
End With
xhtmlDoc = SomeFunction(htmlDoc.body.innerHTML)
Set elements = xhtmlDoc.SelectNodes("//body/div/div/div]")
End Sub
htmldoc.queryselectorall("body > div > div > div")ihtmldomchildrencollectionand loop thorought it as an array. Something like this :dim elements as ihtmldomchildrencollection : set elements= htmldoc.queryselectorall("body > div > div > div") : dim i as integer : for i=0 to elements.length-1 : process elements(i) here : next i