Xpath + Scrapy + Python : data point couldn't be scraped

This is the XML structure:

       <font size="3">
           Hiranandani Gardens, Powai

I want to extract : Hiranandani Gardens, Powai

I tried with these:



Both returned an empty list.

Note: we must have to use the text of tag, i.e., "Location:". Otherwise, there are many other places on the site where the same XML structure is used. So, it'll fetch many more unnecessary things apart from the desired value if the text of strong tag is not used.

1 answer

  • answered 2018-09-19 07:03 Andersson

    Try below XPath to get required output

    //font[@size="3" and normalize-space(strong)="Location:"]/text()