Bootstrap Community, frontend Development

In Selenium using Data Driven Approach where in the drop down requires selection of 2 values at a time

In the Excel have entered two values which are separated by comma as seen below

select fields

Amount , Stage (these are the values)

Created a Utility for this as seen below

-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)

{

}

Have called this util in the page and have also created the By locators in the page:

The Method can be seen below

-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);

}

In the Test Page have created the Data Provider in order to read the values from the Excel and have called the Data Provider

name in the Test class as seen below

- @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);

}

Now when i run this script it does not show the values which are entered in the Excel so can some one please let me know

* what change i need to do in the utils method?

sandhyaautomation () - 3 years ago - Reply 0