title: Collect data into a CSV file using Scrapy
body: <p>I'm learning how to use <a href="https://scrapy.org/" rel="nofollow noreferrer">Scrapy</a></p>
  <h3>spider.py</h3>
  <pre><code>import scrapy
  
  class TestSetSpider(scrapy.Spider):
    name = &quot;test_spider&quot;
    start_urls = ['https://example.html']
  
    def parse(self, response):
       for brickset in response.xpath('//div[@class=&quot;product-name&quot;]'):
         yield {
           'name': brickset.xpath('h1/text()').extract_first(),
         }
  </code></pre>
  <p>I run this spider with command: <code>scrapy crawl test_spider -o test.csv</code></p>
  <p>This is working fine for <code>//div[@class=&quot;product-name&quot;</code>, but I don't know how to add another CSS/XPath class in the same spider file</p>
  <p>I'm trying this but it does't work</p>
  <pre><code>import scrapy
  
  class TestSetSpider(scrapy.Spider):
    name = &quot;test_spider&quot;
    start_urls = ['https://example.html']
  
    def parse(self, response):
       for test in response.xpath('//div[@class=&quot;product-name&quot;]'):
         yield {
           'name': test.xpath('h1/text()').extract_first(),
         }
  
     def parse(self, response):
       for attempt in response.xpath('//div[@class=&quot;another-class&quot;]'):
         yield {
           'color': attempt.xpath('h1/a/text()').extract_first(),
         }
  </code></pre>
  <p>Please help me to do this.</p>