title: Can I get a web element inside another web element?
body: <p><strong>Yo dawg I heard you like web elements...</strong></p>
  
  <p>So I would like to know if it is possible to find a web element by class, id or any other selector and then inside that find another element by class etc.</p>
  
  <p><strong>Background</strong></p>
  
  <p>I have some container with an id that contains a collection of elements I want to put into a list by class, the problem is that if I try to <code>getElements(By.class)</code> it will pick up some elements outside that I don't want.</p>
  
  <p><strong>Attempted</strong></p>
  
  <p>I have tried doing it with <code>XPATH</code>but it feels dirty like hard coding. Since these tests should be robust I thought there must be a better way of doing it.</p>
  
  <p>This code captures elements outside of what I want</p>
  
  <pre><code>public double checkStars(){
      List&lt;WebElement&gt; starsOn = driver.findElements(By.className("on"));
      return starsOn.size();
  }
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>Can I select a web element when limiting the search to inside another web element and how is it done?</p>