title: Got ambiguous match error while trying to count number of element that exist on the page
body: <p>I'm trying to count how many the star is selected based on this HTML</p>
  
  <pre><code>&lt;div class="c-fld"&gt;
    &lt;ul class="js-review-star c-rating"&gt;
      &lt;li data-value="1" title="Very Bad product" class="c-rating__unit is-selected"&gt;
        &lt;span class="c-rating__icon c-icon c-icon--star c-icon--large"&gt;&lt;/span&gt;&lt;/li&gt;
      &lt;li data-value="2" title="Bad product" class="c-rating__unit is-selected"&gt;
        &lt;span class="c-rating__icon c-icon c-icon--star c-icon--large"&gt;&lt;/span&gt;&lt;/li&gt;
      &lt;li data-value="3" title="Average" class="c-rating__unit is-selected"&gt;
        &lt;span class="c-rating__icon c-icon c-icon--star c-icon--large"&gt;&lt;/span&gt;&lt;/li&gt;
      &lt;li data-value="4" title="Good stuff!" class="c-rating__unit"&gt;
        &lt;span class="c-rating__icon c-icon c-icon--star c-icon--large"&gt;&lt;/span&gt;&lt;/li&gt;
      &lt;li data-value="5" title="I love it!" class="c-rating__unit"&gt;
        &lt;span class="c-rating__icon c-icon c-icon--star c-icon--large"&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>From that, I use this method:</p>
  
  <pre><code>def change_review_rating
    @count = page.all('.c-rating__unit.is-selected').count
    puts = "number of element: #{@count}"
  end
  </code></pre>
  
  <p>I also tried using another form of selector like these:</p>
  
  <p>CSS</p>
  
  <p><code>.c-rating .is-selected</code></p>
  
  <p>XPATH</p>
  
  <p><code>//li[contains(@class, 'is-selected')]</code></p>
  
  <p>but all of them is returning <code>Ambiguous match, found 3 elements matching xpath/css (Capybara::Ambiguous)</code>. I know there are 3 elements matching, that's why I need the code to count it. Can you help me figure out what's wrong with my code?</p>