I know how to retrieve information from a webpage. Something like:
To cycle through the dom-object you can use the following methods:
getElementById()
getElementsByTagName()
getElementsByclassName()
But they all require a specified class name.
My question: What if I don't know the specified names. So how can I retrieve the id-, tag-, and class names
HTML example:
I want to retrieve the following data from the above HTML and put them in a sheet like this:
![](/board/proxy.php?image=http%3A%2F%2Fi776.photobucket.com%2Falbums%2Fyy50%2Fstrooman%2FNaamloos_zps65c7b76b.png&hash=277503103b8ecd9c103bc9f66c2b714a)
Code:
With New InternetExplorer
.navigate "http://dealshout.com/"
Do
DoEvents
Loop Until .readyState = 4
For Each objPrice In .Document.getElementsByTagName("div")
If objPrice.className = "archiveInfoContent" Then
strPrice = objPrice.innerText
End If
Next
End With
To cycle through the dom-object you can use the following methods:
getElementById()
getElementsByTagName()
getElementsByclassName()
But they all require a specified class name.
My question: What if I don't know the specified names. So how can I retrieve the id-, tag-, and class names
HTML example:
HTML:
<div id="main">
<h3>
<span class="fr"> DealShout.com </span>
<span class="highlightSearchTerm">Lego</span>
</h3>
<div id="archiveWrap">
<div class="archiveListing">
<div class="archiveInfoContent"> $119.94 </div>
<div class="archiveCompareButton">
<div>
<a class="button large" href="http://dealshout.com/toys-and-games/lego-chima-flying-phoenix-fire-temple-70146/" title="LEGO Chima Flying Phoenix Fire Temple (70146)">Compare Prices</a>
</div>
</div>
</div>
</div>
</div>
I want to retrieve the following data from the above HTML and put them in a sheet like this:
![](/board/proxy.php?image=http%3A%2F%2Fi776.photobucket.com%2Falbums%2Fyy50%2Fstrooman%2FNaamloos_zps65c7b76b.png&hash=277503103b8ecd9c103bc9f66c2b714a)