I have a multiple drop-downs and need to automate them.
I added the code below, how do I add them in one step?
or
make it easier
or
how do I add them in one function?
I'm using eclipse and TestNG plugin with selenium and maven dependencies
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
public class InstallationPage extends CreateNewStore {
@FindBy(id ="is-selling")
WebElement firstSelection;
@FindBy(name="setting[selling_channels][]")
WebElement secondSelection;
@FindBy(id = "products-select")
WebElement thirdSelection;
@FindBy(id = "range-select")
WebElement fourthSelection;
@FindBy(id= "industry-select")
WebElement fifthSelection;
@FindBy(xpath = "//input[@value='Yes']")
WebElement firstRadio;
@FindBy(xpath = "//input[@value='No']")
WebElement seondRadio;
public void InstallationSteps()
{
Select selectObject = new Select(firstSelection);
selectObject.selectByIndex(2);
Select selectObject = new Select(secondSelection);
selectObject.selectByIndex(3);
Select selectObject = new Select(thirdSelection);
selectObject.selectByIndex(2);
Select selectObject = new Select(fourthSelection);
selectObject.selectByIndex(2);
Select selectObject = new Select(fifthSelection);
selectObject.selectByIndex(2);
} }