Here is the HTML code
<!DOCTYPE html>
<html lang="en">
<div class="container" id="content-area">
<div class="flex-row flex-baseline flex-space-between" data-id="1826" id="info">
<h1 class="no-margin">XYZ</h1>
<div class="new-stack" id="sublists">Added</div>
</div>
</div>
I am looking to pull the data-id attribute inside div tag. Here is what I am trying using CSS Selector
>>> response.css("#content-area div")[0].css("::attr[data-id]").get()
And I got below error
cssselect.parser.SelectorSyntaxError: Got pseudo-element ::attr not at the end of a selector
Here is how I solved it by combining CSS and XPATH Selectors.
>>> response.css("#content-area div")[0].xpath("@data-id").get()
'1826'
Is there any solution which can do this using just CSS Selector?