seleniumWebdriver:date字段正在填充string发送,但稍后更改为其他date一旦焦点改变

我需要在我的应用程序的date字段中inputdate。 我已经做了一个Java代码,每天都这样做。 所以我只是在电子表格列中inputdate和数据。 使用apache poi和selenium webdriver,我将获取它并在应用程序的date字段中input。 date字段有一个日历popup时,有一个焦点设置在那里。 我简单地绕过它,通过清除字段中的默认date,并从Excel表格中inputdate作为string。 上面的逻辑工作正常。 但现在我input的date是2015年6月12日(美国时区),inputdate也是一样的。 但是当焦点设置到下一个字段时,date变为2015年12月16日。 我不明白为什么会发生这种情况,当然,怎么可能避免呢?

private static void setBloodGlucose(String vitalname, String date, String time, String vitaldata) throws Exception { Log.info("Entering vital data: " + vitalname); KeyActions.click(OR, "btnGearBloodGlucose"); KeyActions.clickById(OR, "btnBloodGlucose"); KeyActions.waitFor("4"); KeyActions.input(OR, "txtBloodGlucoseDate", date); KeyActions.input(OR, "txtBloodGlucoseTime", time); KeyActions.input(OR, "txtBloodGlucose", vitaldata); KeyActions.clickById(OR, "btnBloodGlucoseSave"); } public static void waitFor(String data) throws Exception { try { TimeUnit.SECONDS.sleep(Long.parseLong(data)); } catch (Exception e) { Log.error("Not able to Wait --- " + e.getMessage()); DriverScript.bResult = false; } } public static void input(Properties OR, String object, String data) { try { wait = new WebDriverWait(driver, Constants.TIMEOUT); Log.info("Entering the text in " + object); wait.until(ExpectedConditions.elementToBeClickable(By.xpath(OR .getProperty(object)))); driver.findElement(By.xpath(OR.getProperty(object))).click(); driver.findElement(By.xpath(OR.getProperty(object))).clear(); driver.findElement(By.xpath(OR.getProperty(object))).sendKeys( Keys.chord(Keys.CONTROL, "a"), data); } catch (Exception e) { Log.error("Not able to Enter the text in " + object); Log.error(e.getMessage()); DriverScript.bResult = false; } } public static String getCellData(int rowNum, int colNum, String sheetName) throws Exception { try { ExcelWSheet = ExcelWBook.getSheet(sheetName); Cell = ExcelWSheet.getRow(rowNum).getCell(colNum); DataFormatter df = new DataFormatter(); String celldata = df.formatCellValue(Cell); // String CellData = Cell.getStringCellValue(); return celldata; } catch (Exception e) { Log.error("Class Utils | Method getCellData | Exception desc : " + e.getMessage()); DriverScript.bResult = false; return ""; } }