title: selecting elements in WebDriver using xpath
body: <p>How do I select only the parent span webelement and not the child?</p>
  
  <p>List  summaryLinks = summary.findElements(By.xpath(""));</p>
  
  <p>My HTML code :   </p>
  
  <pre><code>&lt;li&gt;
  &lt;div class="mod-indent mod-indent-2"&gt;
  &lt;a href="http://mysite.com"&gt;
  &lt;img class="activityicon" alt="URL" src="http://mysite.com"&gt;
  &lt;span class="instancename"&gt;LinkText &lt;span class="accesshide "&gt; URL&lt;/span&gt;&lt;/span&gt;
  &lt;/a&gt;
  &lt;/div&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>I tried the following xpaths but didn't work<br>
  .//div[@class='mod-indent mod-indent-2']/a/span[@class='instancename']</p>
  
  <p>.//div[@class='mod-indent mod-indent-2']/a/span[1]</p>
  
  <p>.//div[@class='mod-indent mod-indent-2']/a/span/.</p>
  
  <p>.//div[@class='mod-indent mod-indent-2']/a/span [position() =1]</p>
  
  <p>.//div[@class='mod-indent mod-indent-2']/a/span/span [position() =1]</p>