0

Need some help on getting the content (text) of the anchor that hold the email address while performing a scrape. I've tried //*[@id="panel"]/p[2]/span[2]/a but my problem is that not always the span appears as the 2nd child. I presume if I could target the element with the href mailto would work but unable to do it.

<div id="panel">
<p>Elements here</p>
<p>
    <span class="label">Email:</span>
    <span class="content">
        <a class="link" href="mailto:someone@website.com">
            someone@website.com
        </a>
    </span>
</p>
<p></p>
</div>
McRui
  • 1,879
  • 3
  • 20
  • 31
  • possible duplicate of [How to match attributes that contain a certain string?](http://stackoverflow.com/questions/1390568/how-to-match-attributes-that-contain-a-certain-string) – Artjom B. Sep 17 '15 at 20:39

1 Answers1

0

Use contains()

//div[@id="panel"]//a[contains(@href,"mailto:")]
Mark Thomas
  • 37,131
  • 11
  • 74
  • 101