diff --git a/src/main/java/com/bonus/autoweb/base/AutoMain.java b/src/main/java/com/bonus/autoweb/base/AutoMain.java index 98c1838..66300f0 100644 --- a/src/main/java/com/bonus/autoweb/base/AutoMain.java +++ b/src/main/java/com/bonus/autoweb/base/AutoMain.java @@ -174,7 +174,7 @@ public class AutoMain { //执行鼠标悬停动作-常态值班 - String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[3]"; + String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[4]"; WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath)); action.moveToElement(wectzb).build().perform(); Thread.sleep(300); @@ -301,15 +301,16 @@ public class AutoMain { //执行鼠标悬停动作-检查操练管理 String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[5]"; - WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath)); - action.moveToElement(wectzb).build().perform(); - Thread.sleep(300); + webDriver.findElement(By.xpath(ctzbXpath)).click(); +// WebElement wectzb = +// action.moveToElement(wectzb).build().perform(); +// Thread.sleep(300); //打开日常操练页面 //*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div[1]/div[2] - String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]"; - webDriver.findElement(By.xpath(zbglXpath)).click(); - log.info("打开日常操练页面------------"); +// String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]"; +// webDriver.findElement(By.xpath(zbglXpath)).click(); +// log.info("打开日常操练页面------------"); /* TODO 800 --> 1500 */ Thread.sleep(1500); @@ -322,11 +323,11 @@ public class AutoMain { //点击抽查按钮 webDriver.findElement(By.xpath("/html/body/div/section/div[1]/div[1]/div/div/div/div[3]")).click(); - //定位日常操练iframe的标签 - WebElement insideIframe = webDriver.findElement(By.xpath("/html/body/div/section/div[1]/div[2]/div[1]/iframe")); - webDriver.switchTo().frame(insideIframe); - log.info("定位到日常操练内部iframe-----------"); - Thread.sleep(3000); +// //定位日常操练iframe的标签 +// WebElement insideIframe = webDriver.findElement(By.xpath("/html/body/div/section/div[1]/div[2]/div[1]/iframe")); +// webDriver.switchTo().frame(insideIframe); +// log.info("定位到日常操练内部iframe-----------"); +// Thread.sleep(3000); } /** @@ -363,16 +364,17 @@ public class AutoMain { //执行鼠标悬停动作-检查操练管理 String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[5]"; - WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath)); - action.moveToElement(wectzb).build().perform(); - Thread.sleep(300); + webDriver.findElement(By.xpath(ctzbXpath)).click(); +// WebElement wectzb = +// action.moveToElement(wectzb).build().perform(); +// Thread.sleep(300); //打开检查计划页面 //*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div[1]/div[2] - String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]"; - webDriver.findElement(By.xpath(zbglXpath)).click(); - log.info("打开检查计划页面------------"); - /* TODO 800 --> 1500 */ +// String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]"; +// webDriver.findElement(By.xpath(zbglXpath)).click(); +// log.info("打开检查计划页面------------"); +// /* TODO 800 --> 1500 */ Thread.sleep(1500); //定位检查计划iframe的标签 diff --git a/src/main/java/com/bonus/autoweb/base/DutyLogIOp.java b/src/main/java/com/bonus/autoweb/base/DutyLogIOp.java index c5b50cc..9704031 100644 --- a/src/main/java/com/bonus/autoweb/base/DutyLogIOp.java +++ b/src/main/java/com/bonus/autoweb/base/DutyLogIOp.java @@ -3,6 +3,7 @@ package com.bonus.autoweb.base; import com.bonus.autoweb.DateTimeUtils; import com.bonus.autoweb.TestMain; import com.bonus.autoweb.UI.entity.LogBean; +import com.bonus.autoweb.UI.frame.StringHelper; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver; import org.openqa.selenium.By; @@ -182,26 +183,38 @@ public class DutyLogIOp { LogBean bean = (LogBean) xstream.fromXML(xml); -// //输入天气 -// String tq = bean.getWeather(); -//// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[3]/div/div/div[1]/input -// webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[5]/div/div/div/input")).sendKeys(tq); -// log.info("输入天气----------"); -// Thread.sleep(500); + //输入天气 + String tq = bean.getWeather(); +// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[3]/div/div/div[1]/input + WebElement weatherElement = webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[5]/div/div/div/input")); + if (StringHelper.isEmptyAndNull(weatherElement.getText())){ + weatherElement.clear(); + weatherElement.sendKeys(tq); + log.info("输入天气----------"); + } + Thread.sleep(500); -// //输入最低气温 -// String zdqw = bean.getMin_temperature(); -//// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[4]/div/div/div[1]/input -// webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[7]/div/div/div/input")).sendKeys(zdqw); -// log.info("输入最高气温----------"); -// Thread.sleep(500); + //输入最低气温 + String zdqw = bean.getMin_temperature(); +// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[4]/div/div/div[1]/input + WebElement minTemperatureElement = webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[7]/div/div/div/input")); + if (StringHelper.isEmptyAndNull(minTemperatureElement.getText())){ + minTemperatureElement.clear(); + minTemperatureElement.sendKeys(zdqw); + log.info("输入最低气温----------"); + } + Thread.sleep(500); -// //输入最高气温 -// String zgqw = bean.getMax_temperature(); -//// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[4]/div/div/div[1]/input -// webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[9]/div/div/div/input")).sendKeys(zgqw); -// log.info("输入最高气温----------"); -// Thread.sleep(500); + //输入最高气温 + String zgqw = bean.getMax_temperature(); +// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[4]/div/div/div[1]/input + WebElement maxTemperatureElement = webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[9]/div/div/div/input")); + if (StringHelper.isEmptyAndNull(maxTemperatureElement.getText())){ + maxTemperatureElement.clear(); + maxTemperatureElement.sendKeys(zgqw); + log.info("输入最高气温----------"); + } + Thread.sleep(500); //事件监测 标题 String sjjc_title = bean.getEvent_detection_title();