Utils to select multi select value from drop down
Can someone please let me know what needs to be done for the second value to be selected from the drop down list.
I assume some change needs to be made in the multiselectdropdown method
public void multiselectdropdown(By locator,String value)
{
List<WebElement> dropdownoptions = driver.findElements(locator);
int size = dropdownoptions.size();
System.out.println("Get the size of options:"+ size);
String ar[] = value.split(",");
for(int i=0;i<ar.length;i++)
{
for(int j=0;j<dropdownoptions.size();j++)
{
String text = dropdownoptions.get(i).getText();
System.out.println(text);
try
{
if(!text.isEmpty())
{
if(text.equals(ar[i]))
{
System.out.println("Get the options:"+ar[i]);
dropdownoptions.get(j).click();
}
}
}catch(Exception e)
{
}
Page: in the method calling the same parameters more than once
public void pipeline(String fieldvalue,String savepipe)
{
elementutils.multiselectdropdown(selectfieldsvalueselection, fieldvalue);
elementutils.multiselectdropdown(selectfieldsvalueselection, fieldvalue);
}
Test Page using the Data Provider and calling the dataprovider in the test class
@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);
}