Scrapy grab div with multiple classes?

后端 未结 2 2032
伪装坚强ぢ
伪装坚强ぢ 2021-02-20 04:14

I am trying to grab div\'s with the class: \'product\'. The problem is, some of the div\'s with class \'product\' also have the class \'product-small\'. So when I use xpat

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-20 04:31

    This could be also solved with xpath. You just needed to use contains():

    //div[contains(concat(' ', normalize-space(@class), ' '), ' product ')]
    

    Though, yes, the CSS selector option is more compact and readable.

提交回复
热议问题