4, at this time we can remove the readonly attribute, the problem is easily solved, the code is as follows:
String js = "document.getElementById('createTime').removeAttribute('readonly')"; // Native js, remove attributes
((JavascriptExecutor)driver).executeScript(js); // Force driver to JavascriptExecutor type
driver.findElement(By.id("createTime")).sendKeys("2016-08-24"); //Enter the date
5, you must remember to import this method in the code:
import org.openqa.selenium.JavascriptExecutor;
4, at this time we can remove the readonly attribute, the problem is easily solved, the code is as follows:
String js = "document.getElementById('createTime').removeAttribute('readonly')"; // Native js, remove attributes
((JavascriptExecutor)driver).executeScript(js); // Force driver to JavascriptExecutor type
driver.findElement(By.id("createTime")).sendKeys("2016-08-24"); //Enter the date
5, you must remember to import this method in the code:
import org.openqa.selenium.JavascriptExecutor;