title: Scrapy XPath output different to a browser
body: <p>I can't figure out what's wrong here. I'm using Scrapy to get data off a website that basically looks like this:</p>
  
  <pre><code>        &lt;li class="foo"&gt;
              &lt;span class="date1"&gt;20 hours ago&lt;/span&gt;
  
              &lt;span class="date2"&gt;
                  &lt;span class="bar"&gt;26-06-2015&lt;/span&gt;
              &lt;/span&gt;
          &lt;/li&gt;
  </code></pre>
  
  <p>Now, if I select the first span using XPath in my browser like <code>$x('//li/span[1]//text()')</code>, then I get the expected output <code>'20 hours ago'</code> and when I use the same expression in Scrapy, the result is the same.</p>
  
  <p>However, when I alter the expression to take the second date (<code>class="bar"</code>), hence <code>$x('//li/span[2]//text()')</code> or <code>$x('//li/span[1]/span[1]/text()')</code> it works in the browser but not within Scrapy (the result in an empty array).</p>
  
  <p>What could be the problem, please?</p>