From 928d0491eda004b1e7fcbb431dcbaacb128d4fea Mon Sep 17 00:00:00 2001 From: zfh <15856818120@163.com> Date: Tue, 4 Mar 2025 09:05:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/bonus/autoweb/base/DutyClock.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/bonus/autoweb/base/DutyClock.java b/src/main/java/com/bonus/autoweb/base/DutyClock.java index f227e33..b4c43ff 100644 --- a/src/main/java/com/bonus/autoweb/base/DutyClock.java +++ b/src/main/java/com/bonus/autoweb/base/DutyClock.java @@ -82,7 +82,7 @@ public class DutyClock { //判断是否有相应的元素 try{ Thread.sleep(2000); - webDriver.findElement(By.xpath("html/body/div[6]/div/div[3]/button[2]")); + webDriver.findElement(By.xpath("html/body/div[6]/div/div[3]/button[2]")).click(); log.info("是否确认签到----------"); }catch (Exception e){ log.info("无确认框,在时间范围内----------"); @@ -90,15 +90,26 @@ public class DutyClock { //判断是否有相应的元素 try{ Thread.sleep(2000); - webDriver.findElement(By.xpath("html/body/div[2]/div/div[3]/button[2]")); + webDriver.findElement(By.xpath("html/body/div[2]/div/div[3]/button[2]")).click(); log.info("是否确认签到----------"); }catch (Exception e){ log.info("无确认框,在时间范围内----------"); } - + try { + //点击弹出框确认 + webDriver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div[2]/div[1]")).click(); + } catch (Exception e) { + log.info("当前打卡确认按钮不存在div[2]"); + } + try { + //点击弹出框确认 + webDriver.findElement(By.xpath("/html/body/div[3]/div/div[2]/div/div[2]/div[1]")).click(); + } catch (Exception e) { + log.info("当前打卡按钮不存在div[3]"); + } //点击弹出框确认 - webDriver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div[2]/div[1]")).click(); + //webDriver.findElement(By.xpath("/html/body/div[2]/div/div[2]/div/div[2]/div[1]")).click(); log.info("点击弹出框确认----------"); Thread.sleep(800); }