title: Finding the elements using parent in Selenium
body: <pre><code>&lt;div&gt;
      &lt;span&gt;First line&lt;/span&gt;
      &lt;p&gt;Second line&lt;/p&gt;
      &lt;span&gt;Third line&lt;/span&gt;
      &lt;p&gt;Fourth line&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My requirement is to get to the div and find elements which are the child of the div tag.</p>
  
  <p>If I use css selector as div>p:nth(0) and div>p:nth(1), I will get my 1st and 2nd p tags respectively, the same can be applied for the span also.</p>
  
  <p>But is there a keyword or a way that can be applied after reaching div tag and say (0) which will get my 1st span tag, (1) which will get my 1st p tag, say (2) which will get my 2nd span tag, (3) which will get my 2nd p tag.</p>
  
  <p>I don't where there is a way through css locator or xpath locator to achieve this. If there is a way please share it.</p>