如何使用 VBA 从下一页抓取 mailto
How to scrape mailto from following page using VBA
我正在尝试从 html 文件中抓取 mailto (href),但我无法 "hit" 它。
欢迎任何建议。
<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:whatever@whatever.com' 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
使用 css 属性 = 值选择器,其中 ^ 以运算符开头
Debug.Print ie.document.querySelector("[href^='mailto:']").href
我正在尝试从 html 文件中抓取 mailto (href),但我无法 "hit" 它。
欢迎任何建议。
<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:whatever@whatever.com' 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
使用 css 属性 = 值选择器,其中 ^ 以运算符开头
Debug.Print ie.document.querySelector("[href^='mailto:']").href