I have a page factory class with the following WebElements:
@FindBy(how = How.XPATH,using = "//button[contains(@aria-label, '" + today + "')]")
WebElement startDate;
@FindBy(how = How.XPATH,using = "//button[contains(@aria-label, '" + tomorrow + "')]")
WebElement endDate;
How do I create and call a method to return today's date and tomorrow's date dynamically into the 'today' and 'tomorrow' values inside the contains? From within a main method, I can get the date in the format I want using:
Date dt = new Date();
Calendar c = Calendar.getInstance();
c.setTime(dt);
SimpleDateFormat dateFormatter = new SimpleDateFormat("MMMM d");
String today = dateFormatter.format(dt);
But how do I create this and the method for tomorrow as separate re-usable methods inside of the same page factory class?