Hi All,
Can any one help me for the below scenario..
I have verify the future date for ex: 15.10.2020 (dd.mm.yyyy) and validate the date displayed is for future
Hello User07,
You could get the text by WebUI.getText() and use some javascript to filter out the date and verify if its in the Future.
Link to WebUi.getText : https://docs.katalon.com/katalon-studio/docs/webui-get-text.html
This is what you need.
String futureDate = WebUI.getText(testObjectWithDate)
LocalDate parsedFutureDate = LocalDate.parse(futureDate, DateTimeFormatter.ofPattern("dd.MM.yyyy"))
LocalDate today = LocalDate.now()
assert today.compareTo(parsedFutureDate) < 0
LocalDate.compareTo documentation:
public int compareTo(ChronoLocalDate otherDate)
It returns 0 if both the dates are equal.
It returns positive value if “this date” is greater than the otherDate.
It returns negative value if “this date” is less than the otherDate.