Reputation: 361
How can I parse a Meta Tag such as
<meta itemprop="email" content="[email protected]" class="">
..and extract the email out of it.
When I copy the xPath of this tag, I get the following, which doesn't work
//*[@id="businessDetailsPrimary"]/div[2]/div/meta
Please advise.
Many thanks
Upvotes: 1
Views: 2918
Reputation: 11961
The likelihood is that the itemprop="email"
attribute will be unique across the webpage. In this case, you can select the email by accessing the content
attribute via its XPath
as follows:
//meta[@itemprop="email"]/@content
In case itemprop="email"
is not unique, you can make your XPath
more specific by selecting the element with id
equal to businessDetailsPrimary
first:
//*[@id="businessDetailsPrimary"]//meta[@itemprop="email"]/@content
Upvotes: 3