Monday, 25 May 2020

Current Date Utility Function:

Current Date Utility Function:
------------------------------
public class DateUtility{

static public void selectCurDate(String xpath) throws InterruptedException {
      List<WebElement> dates = getDriver().findElements(By.xpath(xpath));
Date date = new Date();
String curDate = date.getDate()+"";
for(WebElement ele : dates){
String dateTxt = ele.getText();
if (curDate.equalsIgnoreCase(dateTxt)) {
ele.click();
break;
}
}
}
}

2 comments: