Reputation: 2797
I want to find immediate .col.group
children of certain div. How can I do this?
divs = response.css(div.container)
children = divs[0].css('>.col.group') # this doesn't work
How can this be written with both css
and xpath
?
Thank you.
Upvotes: 1
Views: 431
Reputation: 146610
CSS doesn't have a current node concept. So you can do that with CSS. But thing is Scrapy allows you to mix CSS and XPATH. So you can mix them quite well
divs = response.css(div.container)
children = divs[0].xpath('./*[contains(@class, 'col')]') # this doesn't work
Upvotes: 3