diff --git a/src/main/java/com/bonus/autoweb/base/DutyDailyCheck.java b/src/main/java/com/bonus/autoweb/base/DutyDailyCheck.java deleted file mode 100644 index 1caa89e..0000000 --- a/src/main/java/com/bonus/autoweb/base/DutyDailyCheck.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.bonus.autoweb.base; - -import org.openqa.selenium.By; -import org.openqa.selenium.JavascriptExecutor; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.slf4j.LoggerFactory; -import org.slf4j.Logger; - -/** - * 日报审核工作 - */ -public class DutyDailyCheck { - private Logger log = LoggerFactory.getLogger(DutyDailyCheck.class); - private WebDriver webDriver; - - public DutyDailyCheck(WebDriver webDriver) { - this.webDriver = webDriver; - } - - /** - * 日报审核操作 - * @param type 1早报 2晚报 - */ - public void dutyCheckOp(int type) throws Exception { -// JavascriptExecutor jsExecutor = (JavascriptExecutor) webDriver; -// boolean pageLoaded = false; -// -// do { -// pageLoaded = (Boolean) jsExecutor.executeScript("return document.readyState").equals("complete"); -// } while (!pageLoaded); - Thread.sleep(5000); - //定位值班日报并点击 - webDriver.findElement(By.id("tab-4")).click(); - log.info("定位值班日报并点击-----------"); - Thread.sleep(300); - String checkXpath; - //早报 - if(type ==1){ - checkXpath="//*[@id=\"pane-4\"]/div/div[3]/div/div/div[3]/table/tbody/tr[1]/td[5]/div/p[2]"; - }else{ - checkXpath="//*[@id=\"pane-4\"]/div/div[3]/div/div/div[3]/table/tbody/tr[2]/td[5]/div/p[2]"; - } - - //点击审核按钮 - log.info("日报审核类型:"+type+",地址:"+checkXpath+"--------"); - WebElement checkBtn=webDriver.findElement(By.xpath(checkXpath)); - -// JavascriptExecutor js =(JavascriptExecutor)webDriver; -// js.executeScript("arguments[0].setAttribute(arguments[1],arguments[2])",checkBtn,"style","color:rgb(0,145,255)"); - log.info("审核按钮:",checkBtn.getText()); - Thread.sleep(1000*3); - - checkBtn.click(); - log.info("点击日报审核按钮--------"); - Thread.sleep(1000); - - //退出当前iframe, - webDriver.switchTo().defaultContent(); - log.info("退出当前iframe----------"); - Thread.sleep(300); - - //定位应急工作日报审核iframe的标签 - WebElement addIframe = webDriver.findElement(By.id("add-local-scrbsh")); - webDriver.switchTo().frame(addIframe); - log.info("定位应急工作日报审核iframe-----------"); - Thread.sleep(500); - - //同意审核按钮点击 - - WebElement tyCheckBtn=webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/div/div[4]/div[1]/div[16" + - "]/button[4]")); - if(tyCheckBtn.isDisplayed()){ - //存在 - log.info("同意审核按钮存在-----------"); - log.info("同意审核按钮钮:"+tyCheckBtn.getAttribute("class")); - log.info("同意审核按钮:"+tyCheckBtn.getAttribute("type")); - log.info("同意审核按钮:"+tyCheckBtn.getText()); - tyCheckBtn.click(); -// webDriver.findElement(By.xpath("//*[@id=\"app\"]/div/section/div/div[4]/div[1]/div[19]/button[1]")).click(); - - }else{ - log.info("同意审核按钮不存在-----------"); - } - Thread.sleep(800); - - //退出当前iframe, - webDriver.switchTo().defaultContent(); - log.info("退出当前iframe----------"); - Thread.sleep(1000*2); - - - //定位值班管理iframe的标签 - WebElement dutyIframe= webDriver.findElement(By.id("zbgln")); - webDriver.switchTo().frame(dutyIframe); - log.info("定位值班管理iframe的标签----------"); - Thread.sleep(300); - } -}