title: Locating correct element when class names are the same (Selenium)
body: <p>There are two toggle buttons with exact same class names, so the way i could only manage to locate the relevant one is to locate list of those elements and choose the correct index which is not really sufficient as the order can possibly change.</p>
  <pre><code>@FindBy(css = &quot;.switch.toggle-switch&quot;)
  public List&lt;WebElement&gt; toggleList;
  
   private void clickOnAgreeWithTermsToggle(){
          signUpForm.toggleList.get(1).click();
      }
  </code></pre>
  <p>Could somebody kindly let me know how to proceed is such cases, thank you in advance</p>
  <p><a href="https://i.stack.imgur.com/cKSLa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cKSLa.png" alt="enter image description here" /></a></p>