Excel VBA - Referencing HTML <div> Attributes -
i've been struggling days write code output value of 'data-full-name' webpages source code (link screenshot below).
i know can access value of 'class' instnace using objcollection(i).classname, how access other div attributes?
thank you!
webpage source code screenshot
private sub extract_info() dim long dim ie object dim objelement object dim objcollection object ' create internetexplorer object set ie = createobject("internetexplorer.application") ie.visible = false ie.navigate "http://mywebpage.com.au/" ' wait while ie loading... while ie.busy application.wait dateadd("s", 1, now) loop 'begin extraction set objcollection = ie.document.getelementsbytagname("div") = 0 while < objcollection.length if objcollection(i).classname = "listing listing-search listing-data" 'not sure how code here: e.g. msgbox (objcollection(i).data-full-name) end if = + 1 wend end sub
try:
debug.print objcollection(i).getattribute("data-full-name")
Comments
Post a Comment