I'm trying to develop windows based web scraper using HAP, CefSharp, and C#. I dont have deep knowledge of handling DOM and HTML.
By any means, is it possible to scrape email id (or just copy the email id to clipboard) in the following link without opening email client or new tab.
<a class="classAuthorEmail" href="mailto:" aria-label="Mail Option">email</a>
Thanks in advance...
To work with the DOM you will need the querySelectorAll.
var els = document.querySelectorAll("[href^='mailto'");
for example, for the link,
<p><a href="mailto:someone@example.com">Send email</a></p>
You will get : mailto:someone@example.com
To keep with JavaScript you can use the following:
var mails = [];
for (var i = 0, l = els.length; i < l; i++) {
var el = els[i];
mails.push(el.href.replace(/mailto:/gi, ''));
}