Please check if the mentioned code is ok or not for validate the element in drop down. | Selenium Forum
gautam Posted on 26/05/2021

Hi Ashish,

Please confirm if the mentioned code is ok or not. I am not getting any failure. Your code was different so i just wanted to confirm.

public boolean ValidateDropDown(String locatorkey,String portfolio_name) {

WebElement element = getElement(locatorkey);
select = new Select(element);

List<WebElement> list_drop_down = select.getOptions();

for(int i=0; i<list_drop_down.size();i++) {


return true;

return false;


Ashish Thakur Replied on 01/06/2021


Looks good

Related Posts