Test methods should not include any locators.
Instead of having the following code in a test method
selectListBox(SEARCH_MAKE_ID, make);
selectListBox(SEARCH_MODEL_ID, model);
selectListBox(SEARCH_MAXPRICE_ID, price);
the test should have
selectMake(CAR_MAKE);
selectModel(CAR_MODEL);
selectPrice(CAR_MAXPRICE);
See below the code of all 4 methods:
public void selectMake(String make) {
selectListBox(SEARCH_MAKE_ID, make);
}
public void selectModel(String model) {
selectListBox(SEARCH_MODEL_ID, model);
}
public void selectPrice(String price) {
selectListBox(SEARCH_MAXPRICE_ID, price);
}
public void selectListBox(By listLocator, String listVisbleText) {
WebElement listElement = wait.until(ExpectedConditions
.visibilityOfElementLocated(listLocator));
Select list = new Select(listElement);
list.selectByVisibleText(listVisbleText);
}