List<WebElement> dropdownlist = driver.findElements(By.xpath("//*
[contains(@class,'mat-option ng-star-inserted')]//span"));
int count = dropdownlist.size();
for (int j=0; j<=dropdownlist.size(); j++)
{
dropdownlist.get(j).click();
}
My first dropdown list item gets selected and second one is not getting clicked.