I follow a Page object model and I use a Base class which has all common and reusable method and separate pages for each page of my web application.
Right now I am trying to create a method in BasePage that can be used in other pages. And in each page I have used page factory for the elements.
I use the below method in my BaseClass and I am stuck with extracting the locators into the method below so that I can use this method in all pages for different element locators.
BasePage method:
protected boolean CheckSorting(List<WebElement> element) {
List<WebElement> issueTypeDropdown = new LinkedList<>(driver.findElements(By.)); // stuck here
LinkedList<String> issueTypes = new LinkedList<String>();
for (int i = 0; i < issueTypeDropdown.size(); i++) {
// System.out.println(issueTypeDropdown.get(i).getText());
issueTypes.add(issueTypeDropdown.get(i).getText());
}
return Compare(issueTypes);
}
I am stuck here:
List<WebElement> issueTypeDropdown = new LinkedList<>(driver.findElements(By.)); // stuck here
My PageFactory in the pages that I use:
public @FindBy(xpath = "(//INPUT[@type='search'])[4]/following-sibling::UL") List<WebElement> List;