首页 > 代码库 > WebDriver Using JS control the Calendar inputs

WebDriver Using JS control the Calendar inputs

First get the calendar ID,

second using js to set calendar readonly attributes off or remove it.

Third set value for calendar using JS.

 

    String js="document.getElementById(‘train_date‘).removeAttribute(‘readOnly‘);document.getElementById(‘train_date‘).setAttribute(‘value‘,‘2014-12-25‘);";    ((JavascriptExecutor) wd).executeScript(js);

 

WebDriver Using JS control the Calendar inputs