On a single page on our website, there are two that are.. very very similar:

20;A21;

<select class="form-control custom-select ng-untouched ng-pristine ng-invalid" ="SelectEU" name="SelectEU" required="">

“B”

<select class="form-control custom-select ng-untouched ng-pristine" id="SelectEU" name="SelectEU" required="" disabled="">

the differences are :

A has class ng-pristine

B has property disabled=""

How can I click on the first select, A, then select a particular value??

I have tried the following to no avail..

I tried based on ng-pristine

 = await driver.findElement(By.xpath("//select[@class='form-control custom-select ng-untouched ng-pristine ng-invalid']"))[0];  

I tried selecting based on [0]..

element = await driver.findElement(By.xpath("//select[@id='SelectEU']"))[0];  

I tried selecting by the text (A contains the text “Electric Utility”

element = await driver.findElement(By.xpath("//option[@id='SelectEU' and text()='Electric Utility']"))[0];

It all has the error: no such element exists



Source link https://sqa.stackexchange.com/questions/34773/-selenium-webdriver-selecting-particular-select-element-if-there-are-2-e

LEAVE A REPLY

Please enter your comment!
Please enter your name here