title: Select a specific option based on the option group in selenium
body: <p>hopefully this will not be an duplicate. I searched in web but could not find the exact solution for what i need. I have a dropdown with option groups. I need to select a value based on the input option group "Primary Borrower" or "Co-Borrower" from the dropdown and proceed. Could you please help me on how to do that.</p>
  
  <p><a href="https://i.stack.imgur.com/rkqRP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rkqRP.png" alt="dropdown"></a></p>
  
  <p>here is the angular code.</p>
  
  <pre><code>&lt;select name="selected-borrower" id="selected-borrower" data-ng-model="BorrowerCtrl.selected" data-ng-options="borrower.getFullName() group by borrower.getGroup() for borrower in BorrowerCtrl.borrowers | borrowerSort" data-ng-disabled="BorrowerCtrl.selected.updateInProgress" class="ng-pristine ng-valid ng-not-empty ng-touched" aria-invalid="false" style=""&gt;
    &lt;optgroup label="Primary Borrower"&gt;
      &lt;option label="CLAUDINE G SELSER" value="object:1426" selected="selected"&gt;Person One&lt;/option&gt;
    &lt;/optgroup&gt;
    &lt;optgroup label="Co-Borrower"&gt;
      &lt;option label="LEOTA N MACHUCA" value="object:1427"&gt;Person Two&lt;/option&gt;
    &lt;/optgroup&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>any help is appreciated.</p>