On a single page on our website, there are two elements that are.. very very similar:
"A"
<select class="form-control custom-select ng-untouched ng-pristine ng-invalid" id="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 selecting based on ng-pristine
element = 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
element = await driver.findElement(By.xpath("//select[@id='SelectEU'][1]"));
element = await driver.findElements(By.xpath("//option[@id='SelectEU' and text()='Electric Utility']"))[0];
element = await driver.findElement(By.xpath("//select[@id='SelectEU']"))[0];
it should have beenelement = await driver.findElement(By.xpath("//select[@id='SelectEU'][1]"));
Very grateful. I would gladly accept your answer and upvote sir if you provide it here...await driver.executeScript("arguments[0].scrollIntoView()", element);
returns an error for me..