I want to extract the name from a tag.
response.css('h2.product-names::text').get()
But it is returning:
<h2 >
\<a target="\_blank" href="https://www.electronicsbazaar.com/dell-inspiron-13-7348-core-i5-5200u-2-20ghz-8gb-500gb-int-webcam-win-10-13-3-touch" title='Refurbished Dell Inspiron 13 7348 (Core I5 5Th Gen/8GB/500GB/Int/Win 10/13.3" Touch)'\>\\n Refurbished Dell Inspiron 13 7348 (Core I5 5Th Gen/8GB/500GB/Int/Win 10/13.3" Touch) </a>
</h2>
How can I get the text of the link ?
I tried:
response.css('h2.product-names').get()
<h2 >
\<a target="\_blank" href="https://www.electronicsbazaar.com/dell-inspiron-13-7348-core-i5-5200u-2-20ghz-8gb-500gb-int-webcam-win-10-13-3-touch" title='Refurbished Dell Inspiron 13 7348 (Core I5 5Th Gen/8GB/500GB/Int/Win 10/13.3" Touch)'\>\\n Refurbished Dell Inspiron 13 7348 (Core I5 5Th Gen/8GB/500GB/Int/Win 10/13.3" Touch) </a>
</h2>
CodePudding user response:
the problem is that the name, if i read correctly from your screenshot, is contained in the tag The right xpath is:
response.xpath('//h2[@]/a/@title').extract()