Below is the code snippet:
WebElement pooldropdown=driver.findElement(By.xpath("/html/body/section/section[2]/div[1]/select"));
Select sel = new Select(pooldropdown);
List<WebElement> list = sel.getOptions();
System.out.println("Number of Pool items : "+list.size());
for(int i =0; i>list.size() ; i++){
System.out.println(list .get(i).getText());
}
This is the HTML Code provided:
<section id="content-data"><div class="cpoolSelection" id="poolSelection"><div class="cpoolLabel" id="poolLabel">Select Pool : </div><select onchange="callSetPoolId()" id="poolFilter" style="display: none;"><option value="0"> All </option><option selected="true" value="1">National</option><option value="2">Special Reserve</option><option value="3">NAT_PERM</option><option value="4">NE_PERM</option><option value="5">SE_PERM</option><option value="6">NC_PERM</option><option value="7">SC_PERM</option><option value="8">SCNW_PERM</option><option value="9">NC4C_PERM</option><option value="10">RSC_PERM</option><option value="11">A&D_PERM</option><option value="12">FCP</option><option value="13">R&D</option><option value="14">Support</option><option value="15">Other</option><option value="17">RSA Lease</option></select><button class="ui-multiselect ui-widget ui-state-default ui-corner-all poolClass ui-state-active" type="button" aria-haspopup="true" style="width: 228px;">
<span class="ui-icon ui-icon-triangle-1-s"></span>
<span>National</span>
</button>
</div>
I'm encountering issues with selecting the drop-down values using the Selenium code provided above. Can someone assist me in selecting values from the drop-down and validating all the options present?