2 Select drop downs have same Id and class. How to identify uniquely | Selenium Forum
R
Rajyalakshmi Gubbala Posted on 08/12/2020

Hi,

Please refer below HTML code for 2 drop downs. They have same class , id and names. even checked parent and they do have same parent class and names.Pls suggest how to identify uniquely so that i can select drop down values.

<select _ngcontent-c16="" class="form-control common-dropdown selectpicker ng-pristine ng-valid ng-touched" data-dropup-auto="false" data-size="10" data-style="othercolor" id="ddlts" name="ddlts" ng-reflect-name="ddlts" ng-reflect-model="">
<!--bindings={
"ng-reflect-ng-for-of": "Select all,Payment Ops,Payment"
}--><option _ngcontent-c16="">Select all</option><option _ngcontent-c16="">Payment Ops</option><option _ngcontent-c16="">Payment Ops Supervisor</option><option _ngcontent-c16="">ERT</option><option _ngcontent-c16="">ERT Supervisor</option><option _ngcontent-c16="">AP</option><option _ngcontent-c16="">Unassigned</option>
</select>


<select _ngcontent-c16="" class="form-control common-dropdown selectpicker ng-pristine ng-valid ng-touched" data-dropup-auto="false" data-size="10" data-style="othercolor" id="ddlts" name="ddlts" ng-reflect-name="ddlts" ng-reflect-model="">
<!--bindings={
"ng-reflect-ng-for-of": "Credit Card,Paper Check,Electr"
}--><option _ngcontent-c16

="">Credit Card</option><option _ngcontent-c16="">Paper Check</option><option _ngcontent-c16="">Electronic Check</option><option _ngcontent-c16="">Prepaid Mailed Card</option>
</select>


A
Ashish Thakur Replied on 08/12/2020

In this case you can extract both using driver.findelements command

And then you can easily use one which you need by index


R
Rajyalakshmi Gubbala Replied on 09/12/2020

thanks Ashish. able to get now 


Related Posts