I am new to using **XPath**
and this may be a basic question. Kindly bear with me and help me in resolving the issue.
Link is here...
I would like to target the text that comes after the "Contact:" text. The "Contact:" is wrapped in a <b>
tag. I want to target the name-value after the <b>
tag.
I tried this xPath experession name = response.xpath('//div[@style="line-height: 1.5;"]/b').get()
but it only return the Contact: text. I am interested in the text after this "Contact: " text.
<div class="vcard">
<h2><a class="fn org" target="_blank" title="https://patientcaremedical.com" href="https://patientcaremedical.com" onclick="trackClick(32589, 0)">Patient Care Medical</a><sup> <font color="red" size="2"><b>New!</b></font></sup></h2>
<div style="line-height: 1.5;">
<a title="info [at] patientcaremedical [.] com" href="/Patient_Care_Medical/rfq/sid32589.htm"><b><font color="red">Click Here To EMAIL INQUIRY</font></b></a>
<br><b>Contact: </b>Michael Blanchette - Marketing Director
<br>
response.xpath('//div[@style="line-height: 1.5;"]')[0].text_content().split("Contact: ")[1].strip()
. This text node is not related to any tag. You may also tryresponse.xpath('//div[@style="line-height: 1.5;"]/text()')
and then filter received list. – Vova