title: Scrapy: Extract links and text
body: <p>I am new to scrapy and I am trying to scrape the Ikea website webpage. The basic page with the list of locations as given <a href="http://www.ikea.com/">here</a>.</p>
  
  <p>My <strong>items.py</strong> file is given below:</p>
  
  <pre><code>import scrapy
  
  
  class IkeaItem(scrapy.Item):
  
      name = scrapy.Field()
      link = scrapy.Field()
  </code></pre>
  
  <p>And the <strong>spider</strong> is given below:</p>
  
  <pre><code>import  scrapy
  from ikea.items import IkeaItem
  class IkeaSpider(scrapy.Spider):
      name = 'ikea'
  
      allowed_domains = ['http://www.ikea.com/']
  
      start_urls = ['http://www.ikea.com/']
  
      def parse(self, response):
          for sel in response.xpath('//tr/td/a'):
              item = IkeaItem()
              item['name'] = sel.xpath('a/text()').extract()
              item['link'] = sel.xpath('a/@href').extract()
  
              yield item
  </code></pre>
  
  <p>On running the file I am not getting any output. The json file output is something like:</p>
  
  <pre><code>[[{"link": [], "name": []}
  </code></pre>
  
  <p>The output that I am looking for is the name of the location and the link. I am getting nothing.
  Where am I going wrong?</p>