I’m using this XPath for getting the text() that follows mailto:
//a[starts-with(@href, 'mailto')]/text()
Now I want to be able to extract what comes after mailto: for such attribute:
<a href="mailto:info@info.com?subject=hello">here</a>
I want to get: info@info.com?subject=hello
What XPath should I be using to get the string just after the mailto:?
Edit: seems that the mailto: is being generated using javascript.
Can scrapy handle such thing?
<script type="text/javascript">
<!--
var prefix = 'ma' + 'il' + 'to';
var path = 'hr' + 'ef' + '=';
var addy54802 = 'info' + '@';
addy54802 = addy54802 + 'zlango' + '.' + 'com?subject=Career%20at%20Zlango';
var addy_text54802 = 'here';
document.write('<a ' + path + '\'' + prefix + ':' + addy54802 + '\'>');
document.write(addy_text54802);
document.write('<\/a>');
//-->\n </script>
Solution: I think I should be using Selenium for javascript.
Consider below sample XML, for fetching string after
mailto:you can use below xpath expression
it returns
info@info.com?subject=helloIn your case xpath will look like: