diff --git a/out/artifacts/autoWebForLingBi_jar/autoWebForLingBi.jar b/out/artifacts/autoWebForLingBi_jar/autoWebForLingBi.jar new file mode 100644 index 0000000..48157ad Binary files /dev/null and b/out/artifacts/autoWebForLingBi_jar/autoWebForLingBi.jar differ diff --git a/src/main/java/com/bonus/autoweb/TestMain.java b/src/main/java/com/bonus/autoweb/TestMain.java index 61345f3..e093dec 100644 --- a/src/main/java/com/bonus/autoweb/TestMain.java +++ b/src/main/java/com/bonus/autoweb/TestMain.java @@ -31,14 +31,6 @@ public class TestMain { public static void main(String[] args) throws Exception { log.info("执行任务开始。。。。。。"); -// testRCCL(); -// testqd(); -// testjjb(); -// testGetData(); -// testDailrb(); -// start("工作人员请注意,桌号8001顾客正在寻求帮助!!"); -// testLog(); -// testWeather(); new Thread(new Runnable() { @SneakyThrows @Override @@ -182,7 +174,7 @@ public class TestMain { * * @throws Exception */ - private void autoJob() throws InterruptedException { + void autoJob() throws InterruptedException { AutoWebTask autoWebTask = new AutoWebTask(); int logGatherCount = 0; @@ -318,18 +310,6 @@ public class TestMain { if (jjbzaoNum>10){ continue; } -// if (jjbzao == 0 && jjbzao2 == 0){ -// getTime(420); -// } -// //自动在系统内完成接班(上一值完成交班后) -// if (jjbzao == 0 || jjbzao2 == 0){ -// if (jjbzao == 0){ -// jjbzao = autoWebTask.dutyChangeTask1(1,DataConfig.USER_NAME1,DataConfig.PASS1); -// } -// if (jjbzao2 == 0){ -// jjbzao2 = autoWebTask.dutyChangeTask2(1,DataConfig.USER_NAME1,DataConfig.PASS1); -// } -// } if (jjbzao == 0) { getTime(420); } @@ -413,7 +393,6 @@ public class TestMain { } } } else if (DateTimeUtils.isEffectiveDate("16:30", "16:45")) { -// }else if (DateTimeUtils.isEffectiveDate("10:00", "16:45")) { logwanNum++; if (logwanNum>10){ continue; diff --git a/src/main/java/com/bonus/autoweb/base/AutoMain.java b/src/main/java/com/bonus/autoweb/base/AutoMain.java index ffb2382..66e0e3d 100644 --- a/src/main/java/com/bonus/autoweb/base/AutoMain.java +++ b/src/main/java/com/bonus/autoweb/base/AutoMain.java @@ -39,16 +39,12 @@ public class AutoMain { option.setBinary("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"); option.addArguments("--start-maximized"); -// option.addArguments("--force-device-scale-factor=0.75"); option.addArguments("--force-device-scale-factor=0.7"); if (type==8){ option.addArguments("--force-device-scale-factor=0.6"); } option.addArguments("disable-infobars"); -// if(type != 7) { -// //隐藏浏览器 -// option.addArguments("--headless"); -// } + webDriver = new ChromeDriver(option); } @@ -142,15 +138,6 @@ public class AutoMain { */ private void openDuty() throws InterruptedException { Thread.sleep(5000); -// -// try { -// WebElement alertDiv = webDriver.findElement(By.xpath("/html/body/div[2]/div/div[1]/div/div[1]/div[1]/span")); -// if(alertDiv.getText()) { -// -// } -// }catch (Exception e){ -// -// } try { webDriver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS); @@ -171,7 +158,6 @@ public class AutoMain { Thread.sleep(2000); - //判断是否有相应的元素 try { Thread.sleep(2000); @@ -277,14 +263,6 @@ public class AutoMain { log.info("管理标签的ID值为:" + attributeId); Thread.sleep(2000); - -// //执行鼠标悬停动作-预警行动 -// 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); - - //打开预警响应管理页面 //*[@id=\"" + attributeId + "\"]/div/div[2]/div[2]/div[1]/div[2] String zbglXpath = "//*[@id=\"" + attributeId + "\"]/div/div/div[2]/div[4]"; @@ -338,16 +316,7 @@ public class AutoMain { } catch (Exception e) { log.info("无确认框,在时间范围内----------"); } -// WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath)); -// 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 */ Thread.sleep(1500); //定位日常操练iframe的标签 @@ -400,8 +369,6 @@ public class AutoMain { //执行鼠标悬停动作-检查操练管理 -// WebElement wectzb = -// action.moveToElement(wectzb).build().perform(); //判断是否有相应的元素 try { Thread.sleep(2000); @@ -418,15 +385,8 @@ public class AutoMain { } catch (Exception e) { log.info("无确认框,在时间范围内----------"); } - 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 */ - Thread.sleep(1500); + Thread.sleep(1800); //定位检查计划iframe的标签 WebElement dutyIframe = webDriver.findElement(By.id("rccl")); @@ -436,10 +396,5 @@ 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); } } diff --git a/src/main/java/com/bonus/autoweb/task/AutoWebTask.java b/src/main/java/com/bonus/autoweb/task/AutoWebTask.java index ae16f5a..f3b9dc0 100644 --- a/src/main/java/com/bonus/autoweb/task/AutoWebTask.java +++ b/src/main/java/com/bonus/autoweb/task/AutoWebTask.java @@ -356,31 +356,6 @@ public class AutoWebTask { } - public static void main(String[] args) { -// String content = read("C:\\Users\\24526\\Desktop\\宿州部分代码实例\\七个公司资源核查情况.txt"); -// String[] array = content.toString().split("资源核查情况:"); -// -// ArrayList list = new ArrayList(); -// list.add("1"); -// list.add("2"); -// list.add("3"); -// list.add("4"); -// list.add("5"); -// list.add("6"); -// list.add("7"); -// // 打乱顺序 -// Collections.shuffle(list); -//// // 遍历取出元素 -//// for (String day : list) { -//// System.out.println(day); -//// } -// System.out.println(list.get(0)); -// System.out.println(array[Integer.parseInt(list.get(0))].toString()); - - - - } - public static String read(String filename){ String line; StringBuilder content = new StringBuilder();