Skip to main content
All CollectionsBeyond BasicsXPath
Use XPath to locate email addresses from "mailto" links on any website

Use XPath to locate email addresses from "mailto" links on any website

Updated over 6 months ago

Mailto links are used to redirect to an email address instead of a web page URL. When a user clicks on the Mailto link, the default email client on the visitor's computer opens and suggests sending a message to the email address mentioned in the Mailto link.

If a website contains "mailto" links, it is possible to scrape email addresses from it regardless of the website structure.

A standard "mailto" link looks like this in the HTML source code:

<a href="mailto:email@example.com">Send Email</a>
<a href="mailto:email@example.com, secondemail@example.com">Send Email</a>

So the XPath below may work wonders in some cases:

//a[contains(@href,'mailto')]

As for where to input this XPath, you may refer to this tutorial: Customize element XPath

Note: the above instruction only applies to "mailto" hyperlinks like this:

email_address_able_to_be_extracted.jpg
Did this answer your question?