Element Utils which has the method:
Can some one please let me know what needs to be done in order to solve this issue
public void multiselectdropdown(By locator,String ...value)
{
List<WebElement> dropdownoptions = driver.findElements(locator);
for(int i=0;i<dropdownoptions.size();i++)
{
String text = dropdownoptions.get(i).getText();
System.out.println(text);
try
{
if(!text.isEmpty())
{
if(text.equals(value))
{
dropdownoptions.get(i).click();
break;
}
}
}catch (Exception e)
{
}
}
}
}
Page which has the Method
public void pipeline(String fieldvalue,String savepipe)
{
elementutils.waitforElementPresent(DealsLink);
elementutils.doclick(DealsLink);
elementutils.waitforclickingElement(pipeline);
elementutils.doclick(pipeline);
elementutils.waitforElementPresent(Selectfieldsdropdownclick);
elementutils.doclick(Selectfieldsdropdownclick);
elementutils.multiselectdropdown(selectfieldsvalueselection, fieldvalue);
Test Page :
@DataProvider
public Object[][] dealpipeline()
{
Object data[][] = ExcelUtil.getTestData(AppConstants.Deal_Pipeline_Sheet_Name);
return data;
}
@Test(priority=10,dataProvider="dealpipeline")
public void getdealspipelineinfo(String selectfields,String savepipelineas)
{
dealspage.pipeline(selectfields, savepipelineas);
}
Excel :
selectfields |
Amount, Stage |
(values are separated by comma)
Screenshot:
This is the drop-down which allows selecting 2 values at one time