The following code isused to clear the text box value or we can use this to clear the text box in selenium if the clear() function is not working use below code `
if (maturityDate.compareTo(currentDate)<0) { System.out.println("Maturity Date is less than today date"); renewalMaturityDate.click(); JavascriptExecutor js = (JavascriptExecutor)selenium; js.executeScript("arguments[0].value = '';", renewalMaturityDate); renewalMaturityDate.sendKeys(futuredate); } else if (maturityDate.compareTo(currentDate)>0) { System.out.println("Maturity Date is Greater than today date"); renewalMaturityDate.click(); JavascriptExecutor js = (JavascriptExecutor)selenium; js.executeScript("arguments[0].value = '';", renewalMaturityDate); renewalMaturityDate.sendKeys(maturityDate); rm.waitForSeconds(1); }