This commit is contained in:
tqzhang 2024-05-07 16:24:54 +08:00
parent 2b9fb1166d
commit 1125e46314
9 changed files with 1059 additions and 685 deletions

View File

@ -84,6 +84,11 @@
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
<version>4.1.2</version> <version>4.1.2</version>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>4.6.6</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>

View File

@ -2,24 +2,26 @@ package com.bonus.autoweb;
import com.bonus.autoweb.UI.entity.DailyBean; import com.bonus.autoweb.UI.entity.DailyBean;
import com.bonus.autoweb.UI.entity.LogBean; import com.bonus.autoweb.UI.entity.LogBean;
import com.bonus.autoweb.UI.frame.StringHelper; import com.bonus.autoweb.UI.entity.WeatherData;
import com.bonus.autoweb.base.AutoMain;
import com.bonus.autoweb.base.AutoUtils;
import com.bonus.autoweb.base.DataConfig; import com.bonus.autoweb.base.DataConfig;
import com.google.gson.Gson;
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 okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.activation.DataHandler;
import java.io.*; import java.io.*;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import static java.lang.Integer.parseInt; import static java.lang.Integer.parseInt;
@ -72,7 +74,7 @@ public class GetBasicData {
* @author tqzhang * @author tqzhang
* @data 2024/01/16 * @data 2024/01/16
*/ */
public static void getYuJingActionBasicData(int classes) throws ParseException, InterruptedException { public void getYuJingActionBasicData(int classes) throws ParseException, InterruptedException {
Thread.sleep(5000); Thread.sleep(5000);
// webDriver.findElement(By.xpath("//*[@id=\"app\"]/section/header/form/div/div[2]/button[1]")).click(); // webDriver.findElement(By.xpath("//*[@id=\"app\"]/section/header/form/div/div[2]/button[1]")).click();
// Thread.sleep(300); // Thread.sleep(300);
@ -379,7 +381,7 @@ public class GetBasicData {
log.info("天气预警日报更新完成"); log.info("天气预警日报更新完成");
} }
public void getCaoLianBasicData(int classes) throws InterruptedException, ParseException { public void getCaoLianBasicData(int classes) throws InterruptedException, ParseException, IOException {
Thread.sleep(5000); Thread.sleep(5000);
DailyBean dailyBean = readDailyBean("morning_daily"); DailyBean dailyBean = readDailyBean("morning_daily");
DailyBean dailyBean2 = readDailyBean("evening_daily"); DailyBean dailyBean2 = readDailyBean("evening_daily");
@ -391,6 +393,51 @@ public class GetBasicData {
String[] logContentArrayArray = logContent.split("--头部不可修改--"); String[] logContentArrayArray = logContent.split("--头部不可修改--");
String[] checkContentArrayArray = checkContent.split("资源核查情况:"); String[] checkContentArrayArray = checkContent.split("资源核查情况:");
log.info("读取本地模板数据成功"); log.info("读取本地模板数据成功");
OkHttpClient client = new OkHttpClient().newBuilder()
.connectTimeout(180, TimeUnit.SECONDS)
.readTimeout(180, TimeUnit.SECONDS)
.writeTimeout(180, TimeUnit.SECONDS)
.build();
String dataUrl = DataConfig.weatherUrl;
log.info("dataUrl:" + dataUrl);
Request request = new Request.Builder()
.url(dataUrl)
.get()
.build();
Response response;
String result;
String city;
String weatherNoon;
String weatherNight;
String minTemperature;
String maxTemperature;
try {
response = client.newCall(request).execute();
log.info("response:" + response);
result = response.body().string();
log.info("result:" + result);
Gson gson = new Gson();
WeatherData weatherData = gson.fromJson(result, WeatherData.class);
log.info("------weatherData:" + weatherData);
WeatherData.WeatherDataChild weatherDataChild = weatherData.getData();
log.info("------weatherDataChild:" + weatherDataChild);
city = weatherDataChild.getCity();
log.info("city:" + city);
weatherNoon = weatherDataChild.getWeatherNoon();
log.info("weatherNoon:" + weatherNoon);
weatherNight = weatherDataChild.getWeatherNight();
log.info("weatherNight:" + weatherNight);
minTemperature = weatherDataChild.getMinTemperature();
log.info("minTemperature:" + minTemperature);
maxTemperature = weatherDataChild.getMaxTemperature();
log.info("maxTemperature:" + maxTemperature);
} catch (IOException e) {
throw new IOException("天气get请求失败", e);
}
//昨天的日期 //昨天的日期
String data1 = DateTimeUtils.getLastDay(); String data1 = DateTimeUtils.getLastDay();
log.info("昨天的日期:" + data1); log.info("昨天的日期:" + data1);
@ -598,6 +645,11 @@ public class GetBasicData {
logBean.setDaily_submission_content(logData + logContentArrayArray[17]); logBean.setDaily_submission_content(logData + logContentArrayArray[17]);
logBean.setGeneral_chronicles_title(logContentArrayArray[22]); logBean.setGeneral_chronicles_title(logContentArrayArray[22]);
logBean.setGeneral_chronicles_content(logContentArrayArray[23]); logBean.setGeneral_chronicles_content(logContentArrayArray[23]);
logBean.setWeather(weatherNight);
logBean.setMax_temperature(maxTemperature);
logBean.setMin_temperature(minTemperature);
insertData(null, logBean, "log"); insertData(null, logBean, "log");
log.info("日志数据更新完成"); log.info("日志数据更新完成");
log.info("日报数据:" + dailyBean); log.info("日报数据:" + dailyBean);
@ -659,6 +711,11 @@ public class GetBasicData {
logBean.setDaily_submission_content(logData + logContentArrayArray[17]); logBean.setDaily_submission_content(logData + logContentArrayArray[17]);
logBean.setGeneral_chronicles_title(logContentArrayArray[22]); logBean.setGeneral_chronicles_title(logContentArrayArray[22]);
logBean.setGeneral_chronicles_content(logContentArrayArray[23]); logBean.setGeneral_chronicles_content(logContentArrayArray[23]);
logBean.setWeather(weatherNight);
logBean.setMax_temperature(maxTemperature);
logBean.setMin_temperature(minTemperature);
insertData(null, logBean, "log"); insertData(null, logBean, "log");
} }
} }
@ -1240,21 +1297,22 @@ public class GetBasicData {
webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/section/header/form/div/div[5]/div/div[2]")).click(); webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/section/header/form/div/div[5]/div/div[2]")).click();
Thread.sleep(3000); Thread.sleep(3000);
if("通信测试".equals(type)){ if("通信测试".equals(type)){
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/section/main/div/div[3]/table/tbody" + webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/main/div[1]/div[3]/table/tbody" +
"/tr[1]")).click(); "/tr[1]/td[1]/div/label")).click();
Thread.sleep(500); Thread.sleep(500);
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/section/main/div/div[3]/table/tbody" + webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/main/div[1]/div[3]/table/tbody" +
"/tr[2]")).click(); "/tr[2]/td[1]/div/label")).click();
Thread.sleep(1000); Thread.sleep(3000);
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/footer/button[2]")).click();
}else { }else {
for (int i = 1; i < 3; i++) { for (int i = 1; i < 3; i++) {
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/section/main/div/div[3]/table" + webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/main/div[1]/div[3]/table" +
"/tbody/tr["+i+"]")).click(); "/tbody/tr["+i+"]/td[1]/div/label")).click();
Thread.sleep(1000); Thread.sleep(1000);
} }
Thread.sleep(3000);
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/footer[2]/button[2]")).click();
} }
Thread.sleep(3000);
webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/footer/button[2]")).click();
Thread.sleep(2000); Thread.sleep(2000);
//提交 //提交
webDriver.findElement(By.xpath("/html/body/div[2]/div/div[2]/section/div/button[3]")).click(); webDriver.findElement(By.xpath("/html/body/div[2]/div/div[2]/section/div/button[3]")).click();

View File

@ -97,17 +97,18 @@ public class TestMain {
// 应急值班账号 // 应急值班账号
String emergencyPerson = content.toString().split("")[0].split("")[1]; String emergencyPerson = content.toString().split("")[0].split("")[1];
String emergencyPersonPassword = content.toString().split("")[1].split("")[1]; String emergencyPersonPassword = content.toString().split("")[1].split("")[1];
Thread.sleep(2000);
// autoWebTask.addExercisePlan("通信测试", "", 1, emergencyPerson, // autoWebTask.addExercisePlan("通信测试", "", 1, emergencyPerson,
// emergencyPersonPassword); // emergencyPersonPassword);
// Thread.sleep(5000); autoWebTask.addExercisePlan("日常操练", "", 1, emergencyPerson,
// autoWebTask.addExercisePlan("日常操练", "", 1, emergencyPerson, emergencyPersonPassword);
// emergencyPersonPassword); Thread.sleep(1000);
// Thread.sleep(5000);
// autoWebTask.addExercisePlan("日常操练", "", 2, emergencyPerson,
// emergencyPersonPassword);
// Thread.sleep(5000);
autoWebTask.addExercisePlan("日常操练", "", 2, emergencyPerson, autoWebTask.addExercisePlan("日常操练", "", 2, emergencyPerson,
emergencyPersonPassword); emergencyPersonPassword);
Thread.sleep(1000);
autoWebTask.addExercisePlan("日常操练", "", 3, emergencyPerson,
emergencyPersonPassword);
Thread.sleep(2000);
// autoWebTask.addExercisePlan("日常操练", "", 0, emergencyPerson, emergencyPersonPassword); // autoWebTask.addExercisePlan("日常操练", "", 0, emergencyPerson, emergencyPersonPassword);
// Thread.sleep(2000); // Thread.sleep(2000);
} }
@ -229,7 +230,7 @@ public class TestMain {
String yesterdaySignOutPerson = yesterdayContent.toString().split("")[0].split("")[1]; String yesterdaySignOutPerson = yesterdayContent.toString().split("")[0].split("")[1];
String yesterdaySignOutPersonPassword = yesterdayContent.toString().split("")[1].split("")[1]; String yesterdaySignOutPersonPassword = yesterdayContent.toString().split("")[1].split("")[1];
if(DateTimeUtils.isEffectiveDate("17:26", "17:55")){ if(DateTimeUtils.isEffectiveDate("17:35", "17:55")){
//进行日报信息系统采集及获取工作 //进行日报信息系统采集及获取工作
try { try {
if (logGatherCount == 0){ if (logGatherCount == 0){
@ -252,10 +253,10 @@ public class TestMain {
} catch (IOException e) { } catch (IOException e) {
log.error("更新早上打卡人员", e); log.error("更新早上打卡人员", e);
} }
}else if (DateTimeUtils.isEffectiveDate("06:00", "06:15")) { }else if (DateTimeUtils.isEffectiveDate("06:29", "06:59")) {
//自动完成当值值班日报早报填写上报 //自动完成当值值班日报早报填写上报
if (dailyzao == 0) { if (dailyzao == 0) {
getTime(600); getTime(1000);
try { try {
dailyzao = autoWebTask.dutyAddDailyLogsTask(1,emergencyPerson,emergencyPersonPassword); dailyzao = autoWebTask.dutyAddDailyLogsTask(1,emergencyPerson,emergencyPersonPassword);
@ -264,10 +265,10 @@ public class TestMain {
log.error("日报工作", e); log.error("日报工作", e);
} }
} }
}else if (DateTimeUtils.isEffectiveDate("06:16", "06:30")) { }else if (DateTimeUtils.isEffectiveDate("06:16", "06:28")) {
//完成值班日志填写提交晚班日志此次值班日志为总结前一天晚上的情况 //完成值班日志填写提交晚班日志此次值班日志为总结前一天晚上的情况
if (logzao == 0) { if (logzao == 0) {
getTime(600); getTime(500);
try { try {
logzao = autoWebTask.dutyAddLogsTask(1,emergencyPerson,emergencyPersonPassword); logzao = autoWebTask.dutyAddLogsTask(1,emergencyPerson,emergencyPersonPassword);
}catch (Exception e){ }catch (Exception e){
@ -287,8 +288,6 @@ public class TestMain {
//使用应急值班账号签到 //使用应急值班账号签到
try { try {
signInzao = autoWebTask.dutySigin(1, 1, emergencyPerson, emergencyPersonPassword); signInzao = autoWebTask.dutySigin(1, 1, emergencyPerson, emergencyPersonPassword);
} catch (Exception e) { } catch (Exception e) {
log.error("应急值班打卡任务", e); log.error("应急值班打卡任务", e);
} }
@ -363,25 +362,33 @@ public class TestMain {
// int index = random.nextInt(array.length); // int index = random.nextInt(array.length);
// log.info("随机值为:" + index); // log.info("随机值为:" + index);
// log.info("随机值为:" + array[index]); // log.info("随机值为:" + array[index]);
Thread.sleep(2000); try {
addExercisePlan = autoWebTask.addExercisePlan("通信测试", "", 1, emergencyPerson, Thread.sleep(2000);
emergencyPersonPassword); addExercisePlan = autoWebTask.addExercisePlan("通信测试", "", 1, emergencyPerson,
Thread.sleep(1000 * 700); emergencyPersonPassword);
addExercisePlan = autoWebTask.addExercisePlan("日常操练", "", 1, emergencyPerson, Thread.sleep(1000 * 700);
emergencyPersonPassword); addExercisePlan = autoWebTask.addExercisePlan("日常操练", "", 1, emergencyPerson,
Thread.sleep(1000 * 700); emergencyPersonPassword);
addExercisePlan = autoWebTask.addExercisePlan("日常操练", "", 2, emergencyPerson, Thread.sleep(1000 * 700);
emergencyPersonPassword); addExercisePlan = autoWebTask.addExercisePlan("日常操练", "", 2, emergencyPerson,
Thread.sleep(1000 * 700); emergencyPersonPassword);
addExercisePlan = autoWebTask.addExercisePlan("日常操练", "", 3, emergencyPerson, Thread.sleep(1000 * 700);
emergencyPersonPassword); addExercisePlan = autoWebTask.addExercisePlan("日常操练", "", 3, emergencyPerson,
Thread.sleep(2000); emergencyPersonPassword);
Thread.sleep(2000);
}catch (Exception e){
log.error("操练", e);
}
} }
}else if (DateTimeUtils.isEffectiveDate("10:30", "10:35")) { }else if (DateTimeUtils.isEffectiveDate("10:30", "10:35")) {
autoWebTask.changeTodayPersonaTask(1,emergencyPerson,emergencyPersonPassword); try {
// TODO 更新昨日签退人员账号 autoWebTask.changeTodayPersonaTask(1,emergencyPerson,emergencyPersonPassword);
String value = GetBasicData.resolveGarbledCode("E:\\bns\\config\\今日值班账号.txt"); // TODO 更新昨日签退人员账号
AutoUtils.write("E:\\bns\\config\\昨日值班账号.txt", value.replace("今日","昨日")); String value = GetBasicData.resolveGarbledCode("E:\\bns\\config\\今日值班账号.txt");
AutoUtils.write("E:\\bns\\config\\昨日值班账号.txt", value.replace("今日","昨日"));
}catch (Exception e){
log.error("更新昨日签退人员账号", e);
}
}else if (DateTimeUtils.isEffectiveDate("12:30", "14:30")) { }else if (DateTimeUtils.isEffectiveDate("12:30", "14:30")) {
//进行日志信息系统采集及获取工作 //进行日志信息系统采集及获取工作
try { try {
@ -396,7 +403,7 @@ public class TestMain {
}catch (Exception e) { }catch (Exception e) {
log.error("信息采集工作", e); log.error("信息采集工作", e);
} }
}else if (DateTimeUtils.isEffectiveDate("16:50", "17:20")) { }else if (DateTimeUtils.isEffectiveDate("17:01", "17:29")) {
//自动完成当值值班日报晚报填写上报 //自动完成当值值班日报晚报填写上报
if (dailywan == 0) { if (dailywan == 0) {
getTime(1200); getTime(1200);

View File

@ -0,0 +1,117 @@
package com.bonus.autoweb.UI.entity;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
/**
* FileName: WeatherData
*
* @author tqzhang
* Date: 2024/4/9 14:11
* Description:天气
*/
@Data
public class WeatherData {
private int code;
private WeatherDataChild data;
public static class WeatherDataChild {
private int page;
private int rows;
private String city;
@SerializedName("weather12") // 使用注解指定 JSON 中的字段名
private String weatherNoon;
@SerializedName("weather24") // 使用注解指定 JSON 中的字段名
private String weatherNight;
@SerializedName("temperature1") // 使用注解指定 JSON 中的字段名
private String minTemperature;
@SerializedName("temperature2") // 使用注解指定 JSON 中的字段名
private String maxTemperature;
private String rectime;
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getRows() {
return rows;
}
public void setRows(int rows) {
this.rows = rows;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getWeatherNoon() {
return weatherNoon;
}
public void setWeatherNoon(String weatherNoon) {
this.weatherNoon = weatherNoon;
}
public String getWeatherNight() {
return weatherNight;
}
public void setWeatherNight(String weatherNight) {
this.weatherNight = weatherNight;
}
public String getMinTemperature() {
return minTemperature;
}
public void setMinTemperature(String minTemperature) {
this.minTemperature = minTemperature;
}
public String getMaxTemperature() {
return maxTemperature;
}
public void setMaxTemperature(String maxTemperature) {
this.maxTemperature = maxTemperature;
}
public String getRectime() {
return rectime;
}
public void setRectime(String rectime) {
this.rectime = rectime;
}
@Override
public String toString() {
return "WeatherDataChild{" +
"page=" + page +
", rows=" + rows +
", city='" + city + '\'' +
", weatherNoon='" + weatherNoon + '\'' +
", weatherNight='" + weatherNight + '\'' +
", minTemperature='" + minTemperature + '\'' +
", maxTemperature='" + maxTemperature + '\'' +
", rectime='" + rectime + '\'' +
'}';
}
}
@Override
public String toString() {
return "WeatherData{" +
"code=" + code +
", data=" + data +
'}';
}
}

View File

@ -155,7 +155,8 @@ public class AutoMain {
Thread.sleep(5000); Thread.sleep(5000);
//执行鼠标悬停动作-管理 //执行鼠标悬停动作-管理
Actions action = new Actions(webDriver); Actions action = new Actions(webDriver);
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[5]/div/div/div[6]/span/span/div")); WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[6]/div/div/div[6]/span/span" +
"/div"));
action.moveToElement(wegl).build().perform(); action.moveToElement(wegl).build().perform();
Thread.sleep(300); Thread.sleep(300);
@ -200,7 +201,8 @@ public class AutoMain {
Thread.sleep(5000); Thread.sleep(5000);
//执行鼠标悬停动作-管理 //执行鼠标悬停动作-管理
Actions action = new Actions(webDriver); Actions action = new Actions(webDriver);
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[5]/div/div/div[2]/span/span/div")); WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[6]/div/div/div[2]/span/span" +
"/div"));
action.moveToElement(wegl).build().perform(); action.moveToElement(wegl).build().perform();
Thread.sleep(300); Thread.sleep(300);
log.info("执行鼠标悬停动作-管理"); log.info("执行鼠标悬停动作-管理");
@ -239,7 +241,8 @@ public class AutoMain {
Thread.sleep(5000); Thread.sleep(5000);
//执行鼠标悬停动作-管理 //执行鼠标悬停动作-管理
Actions action = new Actions(webDriver); Actions action = new Actions(webDriver);
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[5]/div/div/div[2]/span/span/div")); WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[6]/div/div/div[2]/span/span" +
"/div"));
action.moveToElement(wegl).build().perform(); action.moveToElement(wegl).build().perform();
Thread.sleep(300); Thread.sleep(300);
log.info("执行鼠标悬停动作-管理"); log.info("执行鼠标悬停动作-管理");
@ -282,7 +285,8 @@ public class AutoMain {
Thread.sleep(3000); Thread.sleep(3000);
//执行鼠标悬停动作-管理 //执行鼠标悬停动作-管理
Actions action = new Actions(webDriver); Actions action = new Actions(webDriver);
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[5]/div/div/div[6]/span/span/div")); WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[6]/div/div/div[6]/span" +
"/span/div"));
action.moveToElement(wegl).build().perform(); action.moveToElement(wegl).build().perform();
Thread.sleep(300); Thread.sleep(300);
@ -341,7 +345,8 @@ public class AutoMain {
Thread.sleep(5000); Thread.sleep(5000);
//执行鼠标悬停动作-管理 //执行鼠标悬停动作-管理
Actions action = new Actions(webDriver); Actions action = new Actions(webDriver);
WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[5]/div/div/div[6]/span/span/div")); WebElement wegl = webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/div[1]/div[6]/div/div/div[6]/span/span" +
"/div"));
action.moveToElement(wegl).build().perform(); action.moveToElement(wegl).build().perform();
Thread.sleep(300); Thread.sleep(300);

View File

@ -1,5 +1,7 @@
package com.bonus.autoweb.base; package com.bonus.autoweb.base;
import com.bonus.autoweb.DateTimeUtils;
public class DataConfig { public class DataConfig {
/** /**
* url 网站地址 * url 网站地址
@ -58,5 +60,6 @@ public class DataConfig {
public static final String filePath = "E:\\bns\\config"; public static final String filePath = "E:\\bns\\config";
public static final String weatherUrl = "http://10.138.4.27:9021/EPCIM/control/ypdgt/qxyj/getQXYJ?city=蒙城&rectime" +
"="+ DateTimeUtils.getCurrentDay();
} }

View File

@ -68,7 +68,8 @@ public class DutyDailyCheck {
//同意审核按钮点击 //同意审核按钮点击
WebElement tyCheckBtn=webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/div/div[4]/div[1]/div[19]/button[4]")); WebElement tyCheckBtn=webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/div/div[4]/div[1]/div[16" +
"]/button[4]"));
if(tyCheckBtn.isDisplayed()){ if(tyCheckBtn.isDisplayed()){
//存在 //存在
log.info("同意审核按钮存在-----------"); log.info("同意审核按钮存在-----------");

File diff suppressed because it is too large Load Diff

View File

@ -41,7 +41,7 @@ public class DutyLogIOp {
changeDay(); changeDay();
} }
Thread.sleep(5000); Thread.sleep(5000);
//定位值班日志并点 //定位值班日志并点,
webDriver.findElement(By.id("tab-5")).click(); webDriver.findElement(By.id("tab-5")).click();
log.info("定位值班日志并点击----------"); log.info("定位值班日志并点击----------");
Thread.sleep(5000); Thread.sleep(5000);
@ -182,39 +182,39 @@ public class DutyLogIOp {
xstream.alias("log", LogBean.class); xstream.alias("log", LogBean.class);
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
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")); // 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())){ // if (StringHelper.isEmptyAndNull(weatherElement.getText())){
weatherElement.clear(); // weatherElement.clear();
weatherElement.sendKeys(tq); // weatherElement.sendKeys(tq);
log.info("输入天气----------"); // log.info("输入天气----------");
} // }
Thread.sleep(500); // 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
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")); // 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())){ // if (StringHelper.isEmptyAndNull(minTemperatureElement.getText())){
minTemperatureElement.clear(); // minTemperatureElement.clear();
minTemperatureElement.sendKeys(zdqw); // minTemperatureElement.sendKeys(zdqw);
log.info("输入最低气温----------"); // log.info("输入最低气温----------");
} // }
Thread.sleep(500); // 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
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")); // 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())){ // if (StringHelper.isEmptyAndNull(maxTemperatureElement.getText())){
maxTemperatureElement.clear(); // maxTemperatureElement.clear();
maxTemperatureElement.sendKeys(zgqw); // maxTemperatureElement.sendKeys(zgqw);
log.info("输入最高气温----------"); // log.info("输入最高气温----------");
} // }
Thread.sleep(500); // Thread.sleep(500);
//事件监测 标题 //事件监测 标题
String sjjc_title = bean.getEvent_detection_title(); String sjjc_title = bean.getEvent_detection_title();