使用vba抓取网页
我试图从多个网站上取消信息。
<div class="detailSection"> <span>Officer/Director Detail</span> <span><b>Name & Address</b></span> <br/> <br/> <span>Title VD</span> <br/> <br/> GUNN, BETTY <span> <div> 6922 SOUTH LAGOON DR<br/> PANAMA CITY BEACH, FL 32408<br/> </div>
我能够把所有的信息,除了名称“GUNN,BETTY”。
该网页是http://search.sunbiz.org/Inquiry/CorporationSearch/SearchResultDetail?inquiryType=DocumentNumber&aggregateId=domnp-763425-68d63992-2677-4bd5-9e1e-3f63ef505809&directionType=Initial&searchNameOrder=AMBASSADORBEACHOWNERSASSOCIATI%207634250&searchTerm=763425
Officer_Director_Detail2 = Doc.getElementsByClassName("detailSection")(5).getElementsByTagName("span")(2).innerText copies "Title VD". Officer_Director_Detail3 = Doc.getElementsByClassName("detailSection")(5).getElementsByTagName("span")(3).innerText copies "6922 SOUTH LAGOON DR PANAMA CITY BEACH, FL 32408".
我曾尝试使用“br”和“div”,但都不会复制名称。 帮帮我!!!
试试这段代码,并select你感兴趣的字段(txt(i))'BETTY GUNN,在txt(5)
txt = Split(doc.getElementsByClassName("detailSection")(5).innerText, vbCrLf) For i = 0 To UBound(txt) MsgBox i & ":" & txt(i) Next i