Trouble selecting option in display: none dropdown Selenium - java

I dont ask this question lightly, but it proving to be more problematic than I thought. I have trawled through google looking at possible solutions but it seems I just cannot select a specific option from a dropdown list.
If anyone can give me a pointer or a solution it would be very welcome as I am pulling my hair out trying to get this to work.
Here is the html:
<div id="main-content" class="col-xs-12">
<div class="row">
<div
class="form-horizontal col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4">
<div class="col-xs-12">
<h1>Please sign in</h1>
<div class="form-group form-group-sm">
<div class="form-group">
<div class="form-group">
<div class="form-group" data-bind="visible:loginExternal"
style="display: none;">
<div class="form-group">
<span class="k-widget k-dropdown k-header" style="width: 100%;"
unselectable="on" role="listbox" aria-haspopup="true"
aria-expanded="false" tabindex="0" aria-owns=""
aria-disabled="false" aria-readonly="false" aria-busy="false">
<span class="k-dropdown-wrap k-state-default"
unselectable="on"> <span class="k-input"
unselectable="on">Please select ...</span> <span
class="k-select" unselectable="on"> <span
class="k-icon k-i-arrow-s" unselectable="on">select</span>
</span>
</span> <select data-role="dropdownlist" data-text-field="display"
data-option-label="Please select ..."
style="width: 100%; display: none;"
data-value-primitive="true" data-value-field="irn"
data-bind="source: locations, value: selectedLocation">
<option value="822">Alexandra</option>
<option value="800">Ridge</option>
<option value="896">Ture</option>
<option value="899">Grove</option>
<option value="824">Lea</option>
<option value="825">Mount</option>
<option value="894">Cliffe</option>
<option value="788">Bank</option>
<option value="826">Ponga</option>
<option value="259">Post</option>
</select>
</span>
</div>
<div class="form-group">
<span class="k-widget k-dropdown k-header" style="width: 100%;"
unselectable="on" role="listbox" aria-haspopup="true"
aria-expanded="false" aria-owns="loginSubLoc_listbox"
aria-disabled="true" aria-readonly="false" aria-busy="false"
aria-activedescendant="loginSubLoc_option_selected"> <span
class="k-dropdown-wrap k-state-disabled" unselectable="on">
<span class="k-input" unselectable="on"></span> <span
class="k-select" unselectable="on"> <span
class="k-icon k-i-arrow-s" unselectable="on">select</span>
</span>
</span> <select id="loginSubLoc" data-role="dropdownlist"
data-text-field="display"
data-option-label="Please select ..."
style="width: 100%; display: none;"
data-value-primitive="true" data-value-field="irn"
data-bind="source: sublocations, value: selectedsubLocation, enabled: isSublocationEnabled"
disabled="disabled">
<option value="">Please select ...</option>
<option value="0" selected="selected"></option>
</select>
</span>
</div>
<div class="form-group">
<button id="submit" class="btn btn-lg btn-primary btn-block"
type="button" data-bind="click: btnLoginClicked">Login</button>
</div>
I have tried the following:
WebElement element = driver.findElement(By.cssSelector("div>span>select[data-bind='source: locations, value: selectedLocation']"));
Select dropdown = new Select(element);
driver.findElement(By.cssSelector("div.form-group>span>span.k-dropdown-wrap.k-state-default>span.k-input")).click();
dropdown.selectByValue("822");
I get an error: element not visible: Element is not currently visible and may not be manipulated
I also tried the following:
driver.findElement(By.cssSelector(".k-input")).click();
List<WebElement> popupdd = driver.findElements(By.cssSelector("div>span>select[data-bind='source: locations, value: selectedLocation']>option"));
driver.switchTo().activeElement();
int noOptions = popupdd.size();
System.out.println("Total options = " + noOptions);
if (noOptions > 0) {
for (WebElement e : popupdd) {
System.out.println(e.getAttribute("textContent"));
if (e.getAttribute("textContent").contains(location)) {
System.out.println("Trying to click on : " + location);
e.click();
Thread.sleep(500);
break;
} else {
System.out.println("counld find the entry: " + location);
}
}
}
It prints out correctly the option values but cannot click onthe option I want. I get an error: org.openqa.selenium.ElementNotVisibleException: element not visible
Very frustrating. Not sure how to mover forward wit this one.
Any help would be greatly appreciated as I am presently relying on the Robot class to manipulate the dropdown and want to avoid this method.

1st way: it is not the problem to click any element using the same js. As you know how to get any option the last actions remaning is to perform a click. This should work for you:
WebElement hiddenWebElement =driver.findElement(By(..selector of the element....));
((JavascriptExecutor)driver).executeScript("arguments[0].click()",hiddenWebElement);
2nd way:
JavascriptExecutor js = (JavascriptExecutor) driver;
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("var x = $(\'#subElement\');");
stringBuilder.append("x.click();");
js.executeScript(stringBuilder.toString());
3rd way: using actions builder, advanced user actions API.
WebElement mnEle;
WebElement sbEle;
mnEle = driver.findElement(By.Id("mnEle")).click();
sbEle = driver.findElement(By.Id("sbEle")).click();
Actions builder = new Actions(driver);
// Move cursor to the Main Menu Element
builder.moveToElement(mnEle).Perform();
// Giving 5 Secs for submenu to be displayed
Thread.sleep(5000L);
// Clicking on the Hidden SubMenu
driver.findElement(By.Id("sbEle")).click();
Hope this will help you :)

Here is the Answer to your Question:
As per your Question, to select the option <option value="822">Alexandra</option> you can consider trying the following piece of code:
WebElement select_dropdownlist = driver.findElement(By.xpath("//*[#data-role='dropdownlist' and #data-text-field='display']"));
Select dropdownlist = new Select(select_dropdownlist);
dropdownlist.selectByVisibleText("Alexandra");
OR
WebElement select_dropdownlist = driver.findElement(By.xpath("//*[#data-role='dropdownlist' and #data-option-label='Please select ...']"));
Select dropdownlist = new Select(select_dropdownlist);
dropdownlist.selectByValue("822");
Let me know if this Answers your Question.

Related

Select menu element with Selenium

I would like to select an element of a dropdown menu using Selenium in a Java application.
I tried several times using Select, List < WebElement > etc... with no success.
The html of the webpage is this:
<div class="margin-top_2">
<span class="right_column_2">
<div id="f1:idSelectTipoDoc" class="ui-selectonemenu ui-widget ui-state-default ui-corner-all ui-helper-clearfix" style="vertical-align: middle; width: 198px;">
<div class="ui-helper-hidden-accessible">
<select id="f1:idSelectTipoDoc_input" name="f1:idSelectTipoDoc_input" style="vertical-align:middle">
<option value="">Select a fruit</option><option value="A">Apple</option>
<option value="T">Tangerine</option></select>
</div>
<input type="text" name="f1:idSelectTipoDoc_editableInput" class="ui-selectonemenu-label ui-inputfield ui-corner-all" tabindex="-1" style="cursor: pointer; width: 182px;">
<div class="ui-selectonemenu-trigger ui-state-default ui-corner-right"><span class="ui-icon ui-icon-triangle-1-s"></span></div></div></span>
</div>
This was my last try but the element in dropdown menu was not selected:
//open the dropdown menu
WebElement tipo1 = new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[#id=\"f1:idSelectTipoDoc\"]/div[2]")));
tipo1.click();
// select the Apple line
WebElement tipo2 = new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[#id=\"f1:idSelectTipoDoc\"]")));
Select elem = new Select(tipo2);
elem.selectByVisibleText("Apple");
Anyone know why it is not working? Thanks
your locator is wrong, you are using locator for div element and not select. use:
WebElement tipo2 = new WebDriverWait(driver, Duration.ofSeconds(5)).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//select[#id=\"f1:idSelectTipoDoc_input\"]")));
Select elem = new Select(tipo2);
elem.selectByVisibleText("Apple");

Get and compare first item from drop down menu with an string in selenium webdriver

I have a dropdown menu with 2 options(option1 and option2).I want to get the NAME of the first option and compare with a string.
I tried something like this but not work for me:
The drop down menu has two items:
-first(default) is "simplex"
-second is "duplex"
The HTML drop down is:
<div class="fieldHelp " id="fieldHelp8352">
<script></script>
<select id="8352" class="lazy-droplist" aria-labelledby="8351" name="pMode:value" style="display: none;">
<option selected value="0">simplex</option>
<option value="1">duplex</option>
</select>
<label id="extendClickArea_8352" style="height:40px; width:100%; position: relative;" class="lazy-droplist">
<span class="ui-selectmenu-button lazy-droplist" tabindex="0" id="8352-button" role="combobox" aria-expanded="false" aria- autocomplete="list" aria-owns="8352-menu" aria-haspopup="true" style="width: 100%;" aria-activedescendant="ui-id-1003" aria- labelledby="ui-id-1003" aria-disabled="false" data-modalfocus="">
<span class="ui-icon ui-icon-triangle-1-s"></span>
<span class="ui-selectmenu-text">simplex</span>
</span>
</label>
<div id="bs-help-modal-sm-8352" style="display: none;" class="bs-help-modal-sm-8352 ui-draggable" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
<div class="modal-content"><div class="modal-header ui-draggable-handle">
<button type="button" class="close" aria-label="Close" onclick="closeHelpPopup(event, $('#bs-help-modal-sm-8352'));">
<span aria-hidden="true">×</span></button>
.....
.....
</div>
<script>
$('#bs-help-modal-sm-8352').draggable({ handle: '.modal-header' });
</script>
</div>
Noticed that the code is somehow grayout,inactive but when I tried to extract test "simplex" ,not said that the menu is hidden or something...
Java code is:
Select select = new Select(driver.findElement(By.name("simplex")));
WebElement option = select.getFirstSelectedOption();
String defaultItem = option.getText();
System.out.println(defaultItem);->this variable is empty :(
if (defaultItem == "simplex") {
System.out.println("Is Simplex");
} else {
System.out.println("Is Duplex");
Where I do something wrong because defaultItem is empty...
Thks
In your case, I cant see name attribute with "simplex" anywhere in the code provided by you. Also, a problem I can see in HTML code is it does not have any value for a selected attribute that's why you getting the empty value:
<option selected="" value="0">simplex</option>
Try below method:
Select select = new Select(driver.findElement(By.id("8352")));
List<WebElement> options = select.getOptions();
int optionssize= options.size();
for(int i=0;i<optionssize;i++)
{
if(options.get(i).getText().equals("Simplex"))
{
System.out.println("Is Simplex available at"+i);
break;
}
}
Solved.
The solution was:
String Text = driver.findElement(By.id("the_direct_path_to_this_span_<span class="ui-selectmenu-text">simplex</span>")).getText();
if(text.equals("Simplex"))
{
System.out.println("Is Simplex");
} else {
System.out.println("Is NOT Simplex");
}

Find xpaths and extract text & status of checkbox/radio buttons in a loop

I have a page where I need to extract the text from an xpath and the status of the radio or checkbox that is associated with the text.
Each element is contained in a class called "c-form-group", so i have written a loop to iterate through to extract the "Text" the will be 4 elements found on the page. But it is failing on element 3 & 4, i must have something wrong with my xpath. I have yet to add in the check for the checkbox/radio button,
The first two elements are returning the values i require, then fails on element3.
Here are the 4 text elements i am trying to extract:
Plan B Warranty (Taxi) & Breakdown Recovery
Vehicle Asset Protection - Standard Cover
Negative Equity Cover
You confirm that you have received the VAP key facts leaflet?
Here is the code for the loop.
WebElement elem = driver.findElement(By.className("c-form-group"));
System.out.println("a");
List<WebElement> elementz = elem.findElements(By.xpath("//label[contains(#class,'c-option')]"));
for(int i = 0 ; i< elementz.size() ; i++){
System.out.println("Loop : " + i);
String vapval1 = elementz.get(i).findElement(By.xpath("//label[#class='c-option c-option--right u-px u-py-sm u-clearfix ng-scope' and not(#class='ng-pristine ng-untouched ng-valid ng-valid-required') and not (#class='c-option__radio')]")).getText();
System.out.println("0 = " + vapval1);
String vapval2 = elementz.get(i).findElement(By.xpath("//label[#class='c-option c-option--right u-px u-py-sm u-clearfix' and not(#class='ng-pristine ng-untouched ng-valid ng-valid-required') and not (#class='c-option__radio')]")).getText();
System.out.println("1 = " + vapval2);
String vapval3 = elementz.get(i).findElement(By.xpath("//label[#class,'c-option c-option--right u-px u-py-sm u-clearfix ng-scope' and not(#class='ng-pristine ng-untouched ng-valid') and not (#class='c-option__checkbox')]")).getText();
System.out.println("3 = " + vapval3);
String vapval4 = elementz.get(i).findElement(By.xpath("//label[#class,'c-option c-option--right u-px u-py-sm u-clearfix' and not(#class='ng-pristine ng-untouched ng-valid ng-valid-required') and not (#class='c-option__checkbox')]")).getText();
System.out.println("4 = " + vapval4);
}
Here is the full html, which may help.
<!DOCTYPE html>
<html class="ng-scope" ng-app="dan">
<head>
<body class="u-scroll-y ng-scope" ng-controller="CoreController as cc">
<div class="c-animate c-animate--show u-pos-f-t ng-hide" ng-show="global.alerts.length">
<div class="o-grid-fluid u-h-100 u-pl-0">
<div class="o-grid__row u-ml-0 u-h-100">
<div class="c-loader ng-hide" ng-show="loadingHome" style="">
<nav class="o-grid__col-xl-2 o-grid__col-lg-3 o-grid__col-xs-4 u-p-0 c-card__block u-h-100 u-shadowed u-pos-f-t ng-scope" ng-if="global.loggedIn">
<div class="u-p-0 u-h-100 o-grid__col-xl-10 o-grid__col-lg-9 o-grid__col-xs-8 u-pull-right" ng-class="{ 'o-grid__col-xl-10 o-grid__col-lg-9 o-grid__col-xs-8 u-pull-right' : global.loggedIn }">
<header class="o-layout-table__row u-bg-primary u-shadowed u-clearfix u-px ng-scope" ng-if="global.loggedIn">
<main class="o-view-container">
<div class="o-grid-fluid u-py-md">
<div class="o-grid__row">
<div class="c-animate c-animate--view-slide-in-right c-animate--view-slide-out-right ng-scope" ng-view="" style="">
<div class="o-grid__col-md-10 o-grid__col-xl-8 o-grid__col-xl-offset-2 o-grid__col-md-offset-1 ng-scope">
<div class="u-mb-lg u-text-center">
<h1 class="u-text-bold">Recommendations</h1>
</div>
<form class="ng-valid ng-valid-min ng-valid-max ng-valid-required ng-dirty ng-valid-parse" name="recommend" ng-submit="recommend.$valid" style="">
<div class="o-media c-card c-card__block u-shadowed u-mb-lg ng-scope" ng-if="rc.WarrantyEligible && !rc.prevWarranty()">
<label class="c-form-control-label u-px u-py-sm u-w-100">Warranty Options:</label>
<div class="c-form-group u-p-0 u-mb-sm u-clearfix">
<div class="o-grid__col-md-8">
<label class="c-form-control-label u-text-normal">Product Recommendations (Years):</label>
</div>
<div class="o-grid__col-md-4">
<input class="c-form-control ng-pristine ng-untouched ng-valid ng-valid-min ng-valid-max ng-valid-required" required="" placeholder="Years" ng-model="rc.recommend.year" min="1" max="3" type="number">
</div>
</div>
<div class="c-form-group ng-scope" ng-if="data.answer_taxi">
<label class="c-option c-option--right u-px u-py-sm u-clearfix ng-scope" ng-if="!rc.planA && !rc.prestige" ng-click="cc.utils.audit('recommendation_warranty_plan_taxi_b')">
<input class="ng-pristine ng-untouched ng-valid ng-valid-required" required="" ng-model="rc.recommend.warrantyPlan" value="taxiB" name="warrantyPlan" type="radio">
<i class="c-option__radio"></i>
Plan B Warranty (Taxi) & Breakdown Recovery
</label>
</div>
</div>
<div class="o-media c-card c-card__block u-shadowed u-mb-lg u-text-body u-bg-success" ng-if="!rc.prevVap() && rc.VapEligible ">
<div class="c-form-group">
<label class="c-form-control-label u-px u-py-sm u-w-100">Vehicle Asset Protection Options:</label>
<label class="c-option c-option--right u-px u-py-sm u-clearfix" ng-click="cc.utils.audit('recommend_vap')">
<input class="ng-pristine ng-untouched ng-valid ng-valid-required" required="" ng-model="rc.recommend.vapPlan.plan" value="standard" name="vapPlan" type="radio">
<i class="c-option__radio"></i>
Vehicle Asset Protection - Standard Cover
</label>
<label class="c-option c-option--right u-px u-py-sm u-clearfix ng-scope" ng-if="data.answer_equity == true" ng-click="cc.utils.audit('recommend_negative_equity')">
<input class="ng-untouched ng-valid ng-dirty ng-valid-parse" ng-model="rc.recommend.vapPlan.equity" name="vapPlanEquity" type="checkbox" style="">
<i class="c-option__checkbox"></i>
Negative Equity Cover
</label>
<label class="c-option c-option--right u-px u-py-sm u-clearfix" ng-click="cc.utils.audit('vap_key_facts_checked')">
<input class="ng-pristine ng-untouched ng-valid ng-valid-required" required="" ng-model="rc.recommend.vapCheck" name="vapCheck" type="checkbox">
<i class="c-option__checkbox"></i>
You confirm that you have received the VAP key facts leaflet?
</label>
</div>
</div>
</form>
<div class="c-form-group">
</div>
</div>
</div>
</div>
</main>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js">
<script src="./build/app.js?v=2.13" defer="">
<script src="/build/standalone/jspdf.js" defer="">
<script src="/build/standalone/sigWebTablet.js" defer="">
</body>
</html>
I'm a little confused as to what you are trying to do. You mention getting the text from the elements and also getting the state of the checkboxes. Your XPaths on the outer and inner loop overlap. Your elementz list is pulled from a LABEL that contains the c-option class but then you start with an element from elementz and the first part of your XPath you repeat the search for a LABEL that contains the c-option class.
There is an much easier way to do this. Each of these checkboxes/radiobuttons are INPUT tags and have a name specific to their value.
Plan B Warranty (Taxi) & Breakdown Recovery: <input ... name="warrantyPlan" type="radio">
Vehicle Asset Protection - Standard Cover: <input ... name="vapPlan" type="radio">
Negative Equity Cover: <input ... name="vapPlanEquity" type="checkbox" style="">
You confirm that you have received the VAP key facts leaflet?: <input ... name="vapCheck" type="checkbox">
So with that info, you can just get each INPUT with CSS selectors like
By.cssSelector("input[name='warrantyPlan']")
Once you have the INPUT element, you can check if it's selected using .isSelected().
If you really do need the text, you can get the label because it's the parent of the INPUT we just got. We can do this with an XPath, By.xpath(".."), which gets the parent of the current element.
We can put this all together like
// Plan B Warranty (Taxi) & Breakdown Recovery
WebElement e = driver.findElement(By.cssSelector("input[name='warrantyPlan']"));
System.out.println(e.isSelected()); // false
System.out.println(e.findElement(By.xpath("..")).getText()); // Plan B Warranty (Taxi) & Breakdown Recovery
// Vehicle Asset Protection - Standard Cover
e = driver.findElement(By.cssSelector("input[name='vapPlan']"));
System.out.println(e.isSelected()); // false
System.out.println(e.findElement(By.xpath("..")).getText()); // Vehicle Asset Protection - Standard Cover
I just did the first two. You can see the pattern and apply it for the last two.

how to write a locator and select a dropdown value

I've tried below code :
Select dropdown = new Select(driver.findElement(By.xpath("//a[contains(text(),'--None--')]")));
dropdown.selectByIndex(1);
Getting below error :
Exception in thread "main"
org.openqa.selenium.support.ui.UnexpectedTagNameException: Element
should have been "select" but was "a"
This is my full DOM structure :
<div class="compoundTLRadius compoundTRRadius compoundBorderBottom form-element__row uiMenu" data-aura-rendered-by="2600:0" data-aura-class="uiMenu">
<div id="2574:0" data-aura-rendered-by="2581:0" class="uiPopupTrigger" data-aura-class="uiPopupTrigger" data-interactive-uid="19">
<div data-aura-rendered-by="2583:0"><div data-aura-rendered-by="2576:0">
<a aria-required="false" class="select" aria-disabled="false" aria-haspopup="true" tabindex="0" role="button" aria-label="Salutation" title="" href="javascript:void(0);" data-aura-rendered-by="2577:0" data-interactive-lib-uid="45">--None--</a>
</div>
</div>
</div>
<div class="select-options popupTargetContainer uiPopupTarget uiMenuList uiMenuList--default uiMenuList--left uiMenuList--short" data-aura-rendered-by="2595:0" data-aura-class="uiPopupTarget uiMenuList uiMenuList--default uiMenuList--left uiMenuList--short" aria-labelledby="2574:0"><div class="select-options" role="menu" data-aura-rendered-by="2589:0"><!--render facet: 2590:0-->
<ul class="scrollable" role="presentation" data-aura-rendered-by="2591:0" data- scoped-scroll="true"><!--render facet: 2592:0--></ul>
</div></div></div>
I want code for locating dropdown icon and select a first value from that.

Not able to click ExtJS Dropdown button and select list elements - Selenium Webdriver Java

I am having difficulty in clicking a drop down and selecting option from the list. Below screenshot of the application.
Our application uses heavy ExtJS and below is the HTML code for dropdown button and textbox.
<div id="combobox-1115-bodyEl" class="x-form-item-body x-form-trigger-wrap-focus" role="presentation" style="width: 325px;">
<div id="ext-gen1273" class="x-hide-display x-form-data-hidden" role="presentation"></div>
<input id="ext-gen1272" class="x-form-field x-form-text x-form-focus" type="text" autocomplete="off" tabindex="2" size="20" aria-invalid="false" placeholder="Please Select a XXXX..." data-errorqtip="" style="width: 305px; -moz-user-select: text;" role="textbox" aria-describedby="combobox-1115-errorEl" aria-required="true"></input>
<div id="combobox-1115-triggerWrap" class="x-form-trigger-wrap" role="presentation" style="width: 20px;">
<div id="ext-gen1274" class="x-trigger-index-0 x-form-trigger x-form-arrow-trigger x-form-trigger-last x-unselectable" role="button" style="-moz-user-select: none;"></div>
Below is the code for dropdown list options.
<div id="boundlist-1132" class="x-boundlist x-boundlist-floating x-boundlist-default x-layer x-boundlist-above" style="position: absolute; left: 582px; top: 93px; width: 325px; z-index: 19061;" role="listbox" tabindex="-1">
<div id="boundlist-1132-listEl" class="list-ct" style="overflow: auto;">
<ul>
<li id="ext-gen1312" class="x-boundlist-item" role="option">6757</li>
<li id="ext-gen1309" class="x-boundlist-item" role="option">Customer 1</li>
<li id="ext-gen1300" class="x-boundlist-item" role="option">Customer 2</li>
<li id="ext-gen1301" class="x-boundlist-item" role="option">Customer 3</li>
<li id="ext-gen1302" class="x-boundlist-item" role="option">Customer 4</li>
<li id="ext-gen1310" class="x-boundlist-item" role="option">XYZ Company1</li>
</ul>
</div>
Please help me locate the dropdown button and select a list item from it. Thanks in advance!!
Try using explicit wait with more precise selectors.
By css = By.cssSelector("[placeholder='Please Select a Customer...']");
By option = By.xpath("//li[#role='option'][text()='Customer 2']");
WebDriverWait wait = new WebDriverWait(driver, 10);
//Click the dropdown to populate the list
WebElement dropdown = wait.until(ExpectedConditions.presenceOfElementLocated(css));
dropdown.click();
//Click the option. Notice the xpath is using the text of the customer
WebElement value = wait.until(ExpectedConditions.presenceOfElementLocated(xpath));
value.click();
First you have to click dropdown element(mostly with input tag) and then wait for the li webelemnt to appear .. below is the function which expects webelement with ul tag and value.
public void selectValueFromUnorderedList(WebElement unorderedList, final String value) {
List<WebElement> options = unorderedList.findElements(By.tagName("li"));
for (WebElement option : options) {
//System.out.println(option.getText());
if (value.equalsIgnoreCase(option.getText())) {
option.click();
break;
}
}
}

Categories