Reputation: 10580
i want to get the href
of the <a>
tag.
I tried this;
def parse(self, response):
sel = Selector(response)
sites = sel.xpath('.//div[@class="aaaaaaaaaa"]/h3/span/a')
for site in sites:
Link = site.get_attribute('href')
print Link
but I got that:
help please exceptions.AttributeError: 'Selector' object has no attribute 'get_attribute
Upvotes: 1
Views: 565
Reputation: 20748
You can do this:
def parse(self, response):
sel = Selector(response)
sites = sel.xpath('.//div[@class="block item-title"]/h3/span/a')
for site in sites:
Link = site.xpath('@href').extract()[0]
print Link
Upvotes: 3