砀山自动化小程序 日报上报天气,温度功能添加
This commit is contained in:
parent
ebe0fc6637
commit
029f8070ac
|
|
@ -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));
|
WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath));
|
||||||
action.moveToElement(wectzb).build().perform();
|
action.moveToElement(wectzb).build().perform();
|
||||||
Thread.sleep(300);
|
Thread.sleep(300);
|
||||||
|
|
@ -301,15 +301,16 @@ public class AutoMain {
|
||||||
|
|
||||||
//执行鼠标悬停动作-检查操练管理
|
//执行鼠标悬停动作-检查操练管理
|
||||||
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[5]";
|
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[5]";
|
||||||
WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath));
|
webDriver.findElement(By.xpath(ctzbXpath)).click();
|
||||||
action.moveToElement(wectzb).build().perform();
|
// WebElement wectzb =
|
||||||
Thread.sleep(300);
|
// action.moveToElement(wectzb).build().perform();
|
||||||
|
// Thread.sleep(300);
|
||||||
|
|
||||||
//打开日常操练页面
|
//打开日常操练页面
|
||||||
//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div[1]/div[2]
|
//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div[1]/div[2]
|
||||||
String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]";
|
// String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]";
|
||||||
webDriver.findElement(By.xpath(zbglXpath)).click();
|
// webDriver.findElement(By.xpath(zbglXpath)).click();
|
||||||
log.info("打开日常操练页面------------");
|
// log.info("打开日常操练页面------------");
|
||||||
/* TODO 800 --> 1500 */
|
/* TODO 800 --> 1500 */
|
||||||
Thread.sleep(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();
|
webDriver.findElement(By.xpath("/html/body/div/section/div[1]/div[1]/div/div/div/div[3]")).click();
|
||||||
|
|
||||||
//定位日常操练iframe的标签
|
// //定位日常操练iframe的标签
|
||||||
WebElement insideIframe = webDriver.findElement(By.xpath("/html/body/div/section/div[1]/div[2]/div[1]/iframe"));
|
// WebElement insideIframe = webDriver.findElement(By.xpath("/html/body/div/section/div[1]/div[2]/div[1]/iframe"));
|
||||||
webDriver.switchTo().frame(insideIframe);
|
// webDriver.switchTo().frame(insideIframe);
|
||||||
log.info("定位到日常操练内部iframe-----------");
|
// log.info("定位到日常操练内部iframe-----------");
|
||||||
Thread.sleep(3000);
|
// Thread.sleep(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -363,16 +364,17 @@ public class AutoMain {
|
||||||
|
|
||||||
//执行鼠标悬停动作-检查操练管理
|
//执行鼠标悬停动作-检查操练管理
|
||||||
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[5]";
|
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[5]";
|
||||||
WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath));
|
webDriver.findElement(By.xpath(ctzbXpath)).click();
|
||||||
action.moveToElement(wectzb).build().perform();
|
// WebElement wectzb =
|
||||||
Thread.sleep(300);
|
// action.moveToElement(wectzb).build().perform();
|
||||||
|
// Thread.sleep(300);
|
||||||
|
|
||||||
//打开检查计划页面
|
//打开检查计划页面
|
||||||
//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div[1]/div[2]
|
//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div[1]/div[2]
|
||||||
String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]";
|
// String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div/div[1]";
|
||||||
webDriver.findElement(By.xpath(zbglXpath)).click();
|
// webDriver.findElement(By.xpath(zbglXpath)).click();
|
||||||
log.info("打开检查计划页面------------");
|
// log.info("打开检查计划页面------------");
|
||||||
/* TODO 800 --> 1500 */
|
// /* TODO 800 --> 1500 */
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
|
|
||||||
//定位检查计划iframe的标签
|
//定位检查计划iframe的标签
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.autoweb.base;
|
||||||
import com.bonus.autoweb.DateTimeUtils;
|
import com.bonus.autoweb.DateTimeUtils;
|
||||||
import com.bonus.autoweb.TestMain;
|
import com.bonus.autoweb.TestMain;
|
||||||
import com.bonus.autoweb.UI.entity.LogBean;
|
import com.bonus.autoweb.UI.entity.LogBean;
|
||||||
|
import com.bonus.autoweb.UI.frame.StringHelper;
|
||||||
import com.thoughtworks.xstream.XStream;
|
import com.thoughtworks.xstream.XStream;
|
||||||
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
|
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
|
|
@ -182,26 +183,38 @@ public class DutyLogIOp {
|
||||||
LogBean bean = (LogBean) xstream.fromXML(xml);
|
LogBean bean = (LogBean) xstream.fromXML(xml);
|
||||||
|
|
||||||
|
|
||||||
// //输入天气
|
//输入天气
|
||||||
// String tq = bean.getWeather();
|
String tq = bean.getWeather();
|
||||||
//// /html/body/div[3]/div/div[2]/div/form/div[3]/div/div/div[3]/div/div/div[1]/input
|
// /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);
|
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"));
|
||||||
// log.info("输入天气----------");
|
if (StringHelper.isEmptyAndNull(weatherElement.getText())){
|
||||||
// Thread.sleep(500);
|
weatherElement.clear();
|
||||||
|
weatherElement.sendKeys(tq);
|
||||||
|
log.info("输入天气----------");
|
||||||
|
}
|
||||||
|
Thread.sleep(500);
|
||||||
|
|
||||||
// //输入最低气温
|
//输入最低气温
|
||||||
// String zdqw = bean.getMin_temperature();
|
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
|
// /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);
|
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"));
|
||||||
// log.info("输入最高气温----------");
|
if (StringHelper.isEmptyAndNull(minTemperatureElement.getText())){
|
||||||
// Thread.sleep(500);
|
minTemperatureElement.clear();
|
||||||
|
minTemperatureElement.sendKeys(zdqw);
|
||||||
|
log.info("输入最低气温----------");
|
||||||
|
}
|
||||||
|
Thread.sleep(500);
|
||||||
|
|
||||||
// //输入最高气温
|
//输入最高气温
|
||||||
// String zgqw = bean.getMax_temperature();
|
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
|
// /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);
|
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"));
|
||||||
// log.info("输入最高气温----------");
|
if (StringHelper.isEmptyAndNull(maxTemperatureElement.getText())){
|
||||||
// Thread.sleep(500);
|
maxTemperatureElement.clear();
|
||||||
|
maxTemperatureElement.sendKeys(zgqw);
|
||||||
|
log.info("输入最高气温----------");
|
||||||
|
}
|
||||||
|
Thread.sleep(500);
|
||||||
|
|
||||||
//事件监测 标题
|
//事件监测 标题
|
||||||
String sjjc_title = bean.getEvent_detection_title();
|
String sjjc_title = bean.getEvent_detection_title();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue