更新系统

This commit is contained in:
马三炮 2025-08-11 16:00:59 +08:00
parent 0bb0575106
commit ceaa24dcc5
2 changed files with 52 additions and 10 deletions

View File

@ -38,7 +38,7 @@ public class AutoMain {
System.setProperty(DataConfig.DRIVE_NAME, DataConfig.drivePath); System.setProperty(DataConfig.DRIVE_NAME, DataConfig.drivePath);
ChromeOptions option = new ChromeOptions(); ChromeOptions option = new ChromeOptions();
//添加浏览器地址 //添加浏览器地址
option.setBinary("C:\\Users\\Administrator\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"); option.setBinary("C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe");
option.addArguments("--start-maximized"); option.addArguments("--start-maximized");
option.addArguments("--force-device-scale-factor=0.75"); option.addArguments("--force-device-scale-factor=0.75");
option.addArguments("disable-infobars"); option.addArguments("disable-infobars");
@ -131,10 +131,27 @@ public class AutoMain {
Thread.sleep(300); Thread.sleep(300);
//执行鼠标悬停动作-常态值班
//判断是否有相应的元素
try {
Thread.sleep(2000);
//执行鼠标悬停动作-常态值班 //执行鼠标悬停动作-常态值班
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[4]"; 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();
} catch (Exception e) {
log.info("无确认框,在时间范围内----------");
}
//判断是否有相应的元素
try {
Thread.sleep(2000);
//执行鼠标悬停动作-常态值班
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div/div[4]/div";
WebElement wectzb = webDriver.findElement(By.xpath(ctzbXpath));
action.moveToElement(wectzb).build().perform();
} catch (Exception e) {
log.info("无确认框,在时间范围内----------");
}
Thread.sleep(300); Thread.sleep(300);
@ -191,10 +208,21 @@ public class AutoMain {
Thread.sleep(300); Thread.sleep(300);
//执行鼠标悬停动作-检查操练管理 //执行鼠标悬停动作-检查操练管理
try {
Thread.sleep(2000);
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[5]"; String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div[1]/div[2]/div[5]";
webDriver.findElement(By.xpath(ctzbXpath)).click(); webDriver.findElement(By.xpath(ctzbXpath)).click();
// WebElement wectzb = } catch (Exception e) {
// action.moveToElement(wectzb).build().perform(); log.info("无确认框,在时间范围内----------");
}
//判断是否有相应的元素
try {
Thread.sleep(2000);
String ctzbXpath = "//*[@id=\"" + attributeId + "\"]/div/div/div/div[5]/div";
webDriver.findElement(By.xpath(ctzbXpath)).click();
} catch (Exception e) {
log.info("无确认框,在时间范围内----------");
}
Thread.sleep(1500); Thread.sleep(1500);
//打开检查计划页面 //打开检查计划页面

View File

@ -49,9 +49,23 @@ public class DutyLogIOp {
// /html/body/div[2] 弹窗 您没有填写值班日志的排班班次 // /html/body/div[2] 弹窗 您没有填写值班日志的排班班次
//定位写日志标签打开日志页面
try {
//定位写日志标签打开日志页面 //定位写日志标签打开日志页面
webDriver.findElement(By.xpath("//*[@id=\"pane-5\"]/div/div[2]/div[2]/button")).click(); webDriver.findElement(By.xpath("//*[@id=\"pane-5\"]/div/div[2]/div[2]/button")).click();
log.info("定位写日志标签,打开日志页面----------"); log.info("定位写日志标签,打开日志页面----------/div/div[2]/div[2]/button");
Thread.sleep(1500);
} catch (Exception e) {
log.info("无确认框,在时间范围内----------/div/div[2]/div[2]/button");
}
try {
//定位写日志标签打开日志页面
webDriver.findElement(By.xpath("//*[@id=\"pane-5\"]/div/div[2]/div[2]/button/span")).click();
log.info("定位写日志标签,打开日志页面----------/div/div[2]/div[2]/button/span");
Thread.sleep(1500);
} catch (Exception e) {
log.info("无确认框,在时间范围内----------/div/div[2]/div[2]/button/span");
}
Thread.sleep(300); Thread.sleep(300);