如何使用VBA从后续页面抓取mailto

问题描述 投票:0回答:1

我试图从html文件中抓取mailto(href),但我无法“击中”它。

欢迎任何建议。

       <div class="exhibitor-contact">
            <div class="col">
                <h3>
                whatever           </h3>
      <p>
                    MLW <br />            whatever<br />            75008             Paris              - France          </p>
      <p>
                    <a class='inverse-a-span' href='#tel' id='tel' onclick="return xt_click(this,'C', xtn2, xtpage.replace(/\w*$/, 'exhibitor::tel').replace(/^Exhibitors::/, ''), 'A')">Show Phone Number</a><span style='display:none;'>whatever</span><br />                        <a href='mailto:[email protected]' onclick="return xt_click(this,'C',xtn2, xtpage.replace(/\w*$/, 'exhibitor::email').replace(/^Exhibitors::/, ''), 'A')">Send an Email</a><br />                      </p>
    </div>
          </div>



</section>

码:

Set my_data = IE.Document.getElementsByClassName("anyclass") 
Set mail = IE.Document.getElementsByTagName("a")(0) ActiveSheet.Cells(i, 2).Value = mail.href
html vba web-scraping mailto scrape
1个回答
0
投票

使用css attribute = value选择器,^以operator开头

Debug.Print ie.document.querySelector("[href^='mailto:']").href
© www.soinside.com 2019 - 2024. All rights reserved.