I would like to get the href from the following html
<a class="AirQuality--detailsButton--DBdLS Button--primary--1UQTP" href="/en-IN/forecast/air-quality/l/bf01d09009561812f3f95abece23d16e123d8c08fd0b8ec7ffc9215c0154913c" target="_self">See Details</a>
where href to be extracted based on class class="AirQuality--detailsButton--DBdLS Button--primary--1UQTP" from element a.
I tried doing the following but not returning anything.
response.css('a.AirQuality--detailsButton--DBdLS Button--primary--1UQTP::attr(href)').get()
Full html could be fetched through scrapy by
scrapy shell "https://weather.com/en-IN/weather/today/l/bf01d09009561812f3f95abece23d16e123d8c08fd0b8ec7ffc9215c0154913c"
Any help would be highly appreciated, thanks in advance 🙂
>Solution :
There are two class name . so you need to add dot(.) .Now it’s working.
response.css('a.AirQuality--detailsButton--DBdLS.Button--primary--1UQTP::attr(href)').get()