refactor(autoweb):调整计划执行流程和审计计划逻辑
- 调整 executePlan 方法中的等待时间和元素定位方式 - 优化 auditPlan 方法中的被检查单位选择和提交逻辑 - 删除未使用的代码注释 - 增加异常处理,提高代码的健壮性
This commit is contained in:
parent
85716e216b
commit
ac520b2e4c
|
|
@ -653,11 +653,13 @@ public class GetBasicData {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executePlan(String type, String company, String projectName) throws InterruptedException {
|
private void executePlan(String type, String company, String projectName) throws InterruptedException {
|
||||||
Thread.sleep(2000);
|
Thread.sleep(5000);
|
||||||
|
webDriver.findElement(By.xpath("//*[@id=\"pane-sec\"]/section/header/form/div[1]/div[8]/div/div/button[2]")).click();
|
||||||
|
Thread.sleep(10000);
|
||||||
String checkContent = resolveGarbledCode("D:\\bns\\config\\检查计划评价.txt");
|
String checkContent = resolveGarbledCode("D:\\bns\\config\\检查计划评价.txt");
|
||||||
String[] checkContentArrayArray = checkContent.split("检查评价:");
|
String[] checkContentArrayArray = checkContent.split("检查评价:");
|
||||||
//勾选计划
|
//勾选计划
|
||||||
webDriver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/div[2]/section/main/section/main/div/div[3]/table/tbody/tr[1]")).click();
|
webDriver.findElement(By.xpath("//*[@id=\"pane-sec\"]/section/main/section/main/div/div[3]/table/tbody/tr[1]")).click();
|
||||||
Thread.sleep(800);
|
Thread.sleep(800);
|
||||||
//点击执行按钮--打开选择被检查对象
|
//点击执行按钮--打开选择被检查对象
|
||||||
webDriver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/div[2]/section/main/section/header/button[4]")).click();
|
webDriver.findElement(By.xpath("/html/body/div[1]/section/div[1]/div[2]/div[2]/section/main/section/header/button[4]")).click();
|
||||||
|
|
@ -695,8 +697,6 @@ public class GetBasicData {
|
||||||
webDriver.findElement(By.xpath("/html/body/div/section/main/section/form/div[4]/button[2]")).click();
|
webDriver.findElement(By.xpath("/html/body/div/section/main/section/form/div[4]/button[2]")).click();
|
||||||
Thread.sleep(1500);
|
Thread.sleep(1500);
|
||||||
|
|
||||||
// /html/body/div/div/div/div[2]/div[1]/section/div/section/section/div/div[3]/table/tbody/tr[1]/td[9]/div
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void auditPlan(String type, String company) throws InterruptedException {
|
private void auditPlan(String type, String company) throws InterruptedException {
|
||||||
|
|
@ -781,31 +781,14 @@ public class GetBasicData {
|
||||||
Thread.sleep(1000);
|
Thread.sleep(1000);
|
||||||
webDriver.findElement(By.xpath("/html/body/div[6]/div[1]/div/div/div[1]/div[1]/span[2]")).click();
|
webDriver.findElement(By.xpath("/html/body/div[6]/div[1]/div/div/div[1]/div[1]/span[2]")).click();
|
||||||
log.info("选择被检查单位----------");
|
log.info("选择被检查单位----------");
|
||||||
Thread.sleep(500);
|
|
||||||
// //选择被检查对象
|
|
||||||
// webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/section/header/form/div/div[5]/div/div[2]")).click();
|
|
||||||
// Thread.sleep(3000);
|
|
||||||
// if("通信测试".equals(type)){
|
|
||||||
// webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/main/div[1]/div[3]/table/tbody/tr[1]/td[1]/div/label")).click();
|
|
||||||
// Thread.sleep(500);
|
|
||||||
// webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/main/div[1]/div[3]/table/tbody/tr[2" +
|
|
||||||
// "]/td[1]/div/label")).click();
|
|
||||||
// Thread.sleep(1000);
|
|
||||||
// webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/footer/button[2]")).click();
|
|
||||||
// Thread.sleep(2000);
|
|
||||||
// }else {
|
|
||||||
// for (int i = 1; i < 5; i++) {
|
|
||||||
// webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/main/div[1]/div[3]/table" +
|
|
||||||
// "/tbody/tr["+i+"]/td[1]/div/label")).click();
|
|
||||||
// Thread.sleep(1000);
|
|
||||||
// }
|
|
||||||
// webDriver.findElement(By.xpath("/html/body/div[7]/div/div[2]/section/footer[2]/button[2]")).click();
|
|
||||||
// Thread.sleep(2000);
|
|
||||||
// }
|
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
|
Thread.sleep(2000);
|
||||||
//提交
|
//提交
|
||||||
webDriver.findElement(By.xpath("/html/body/div[4]/div/div[2]/section/div/button[3]")).click();
|
try {
|
||||||
Thread.sleep(3000);
|
webDriver.findElement(By.xpath("/html/body/div[4]/div/div[2]/section/div/button[3]")).click();
|
||||||
|
} catch (Exception e) {
|
||||||
|
webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/section/div/button[3]")).click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue