I am using Scrapy with the following url:
http://www.marzetti.com/products/marzetti/detail.php?bc=35&cid=2&pid=1101&i=pl
I need to capture in the same scrapy item, the following:
/html/body/div/div[2]/table/tbody/tr[3]/td[4]/table/tbody/tr/td/div[2]/table/tbody/tr[2]/td[2]  /div[4]
/html/body/div/div[2]/table/tbody/tr[3]/td[4]/table/tbody/tr/开发者_如何学Ctd/div[2]/table/tbody/tr[2]/td[2]/div[4]`
So here's my code snippet:
hxs = HtmlXPathSelector(response)
    sites = hxs.select('/html/body/div/div[2]/table/tr[3]/td[4]/table/tr')
    items = []
    for site in sites:
        ..............
        item['description'] = site.select('td/div[2]/table/tr[2]/td[2]/div[4] or div[5]//text()').extract()
However, this returns a Boolean answer such as 'description = True', whereas what I need is the actual text within the two divs.
Any suggestions welcome. Thanks. -TM
Use the standard XPath union operator '|' :
  (td/div[2]/table/tr[2]/td[2]/div[4]
| 
   div[5])
          //text()
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论