Index: ssts-web/src/test/resources/test/forgon/disinfectsystem/selenium/config/all/settings.json =================================================================== diff -u -r18296 -r18662 --- ssts-web/src/test/resources/test/forgon/disinfectsystem/selenium/config/all/settings.json (.../settings.json) (revision 18296) +++ ssts-web/src/test/resources/test/forgon/disinfectsystem/selenium/config/all/settings.json (.../settings.json) (revision 18662) @@ -3,7 +3,9 @@ "seleniumBrowserVersion": "11.0", "seleniumHubURL": "http://192.168.2.18:4444/wd/hub", "服务器地址": "http://192.168.2.18:8082/gdsy", - "触摸屏清洗服务地址": "http://localhost/logon.jsp?logonType=washform", + //"服务器地址": "http://localhost/gdsy", + //"触摸屏清洗服务地址": "http://localhost/gdsy/logon.jsp?logonType=washform", + "触摸屏清洗服务地址": "http://192.168.2.18:8082/gdsy/logon.jsp?logonType=washform", "一级供应室用户": { "工号": "cssduser1", "条码": "0100001001", Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java =================================================================== diff -u -r18633 -r18662 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java (.../ALL.java) (revision 18633) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java (.../ALL.java) (revision 18662) @@ -1,8 +1,6 @@ package test.forgon.disinfectsystem.selenium; import java.io.File; -import java.io.IOException; -import java.security.Timestamp; import java.text.SimpleDateFormat; import org.apache.commons.io.FileUtils; @@ -71,7 +69,7 @@ AssertJUnit.fail(e.getMessage()); } } - + private void oneUse() { try { /*** 一级供应室一次性物品 ***/ @@ -147,9 +145,9 @@ + "/homepage/portalPage.jsp", 8); Utils.tryToCloseWarningWindow(); } - logger.info("二级供应室清洗成功"); /** 二级供应室清洗成功 */ wash.wash_secondSupplyRoom(); + logger.info("二级供应室清洗成功"); wash.after(); recyle.init(); /** 一级供应室回收带标识牌的回收单 */ Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/tools/Utils.java =================================================================== diff -u -r18651 -r18662 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/tools/Utils.java (.../Utils.java) (revision 18651) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/tools/Utils.java (.../Utils.java) (revision 18662) @@ -177,7 +177,7 @@ try { String seleniumHubURL = Utils.settings.get("seleniumHubURL").toString(); driver = new RemoteWebDriver(new URL( seleniumHubURL), ieCapabilities); - // driver = new InternetExplorerDriver(ieCapabilities); +// driver = new InternetExplorerDriver(ieCapabilities); String cap = ((InternetExplorerDriver) driver).getCapabilities() .toString(); System.out.println("my cap = " + cap); @@ -988,6 +988,8 @@ String currentwindowhandle = Utils.driver.getWindowHandle(); Utils.driver.switchTo().window(currentwindowhandle); Utils.tryToCloseWarningWindow(); + Utils.waitPageLoaded(); + Utils.doWait(500); } /** @@ -1162,7 +1164,9 @@ public static void clickWebElement(WebElement webElement){ // jsClick(webElement); String tagName = webElement.getTagName(); - if ("button".equalsIgnoreCase(tagName) || "a".equalsIgnoreCase(tagName) || "img".equalsIgnoreCase(tagName)){ + if ("button".equalsIgnoreCase(tagName)){ +// if ("button".equalsIgnoreCase(tagName) || "img".equalsIgnoreCase(tagName)){ +// if ("button".equalsIgnoreCase(tagName) || "a".equalsIgnoreCase(tagName) || "img".equalsIgnoreCase(tagName)){ jsClick(webElement); } else{ Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Assemble.java =================================================================== diff -u -r18647 -r18662 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Assemble.java (.../Assemble.java) (revision 18647) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Assemble.java (.../Assemble.java) (revision 18662) @@ -2,12 +2,15 @@ import java.util.function.Function; +import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.Keys; +import org.openqa.selenium.NoAlertPresentException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Wait; import org.testng.AssertJUnit; import org.testng.annotations.AfterMethod; @@ -109,11 +112,7 @@ Utils.retryingFindAndClick(By .xpath("//div/ul/li[contains(text(), '" + name + "')]")); - // Wait wait = WaitFactory.createDefaultWait(); - // wait.until(ExpectedConditions.alertIsPresent()); - // - // Alert alertBox = Utils.driver.switchTo().alert(); - // alertBox.accept(); + isAlertPresent(); Utils.retryingFindAndClick(By.id("save_print")); /** 获取装配成功后的条码 **/ Utils.barcodes = Utils.getToussesBarcodes(); @@ -139,7 +138,7 @@ By.cssSelector("input[name='basketBarcodeInput']"), Utils.settings.getJSONObject("一级供应室清洗篮筐4").getString("条码") + "\n"); - + Utils.retryingFindAndClick(By.id("checkAllTaskNode-inputRow")); String name = Utils.settings.getJSONObject("灭菌程序").getString("名称1"); WebElement element = Utils.retryingFind(By @@ -162,12 +161,9 @@ .xpath("//div/ul/li[contains(text(), '" + name + "')]")); } - // Wait wait = WaitFactory.createDefaultWait(); - // wait.until(ExpectedConditions.alertIsPresent()); - // - // Alert alertBox = Utils.driver.switchTo().alert(); - // alertBox.accept(); + isAlertPresent(); Utils.retryingFindAndClick(By.id("save_print")); + Utils.doWait(500); /** 获取装配成功后的条码 **/ Utils.barcodes = Utils.getToussesBarcodes(); System.out.println("本次装配条码:" + Utils.barcodes); @@ -219,10 +215,7 @@ name = Utils.settings.getJSONObject("包装类型").getString("名称1"); Utils.retryingFindAndClick(By .xpath("//div/ul/li[contains(text(), '" + name + "')]")); - // Wait wait = WaitFactory.createDefaultWait(); - // wait.until(ExpectedConditions.alertIsPresent()); - // Alert alertBox = Utils.driver.switchTo().alert(); - // alertBox.accept(); + isAlertPresent(); Utils.retryingFindAndClick(By.id("save_print")); /** 获取装配成功后的条码 **/ Utils.barcodes = Utils.getToussesBarcodes(); @@ -305,10 +298,8 @@ name = Utils.settings.getJSONObject("包装类型").getString("名称1"); Utils.retryingFindAndClick(By .xpath("//div/ul/li[contains(text(), '" + name + "')]")); - // Wait wait = WaitFactory.createDefaultWait(); - // wait.until(ExpectedConditions.alertIsPresent()); - // Alert alertBox = Utils.driver.switchTo().alert(); - // alertBox.accept(); + + isAlertPresent(); Utils.retryingFindAndClick(By.id("save_print")); /** 获取装配成功后的条码 **/ Utils.barcodes = Utils.getToussesBarcodes(); @@ -370,7 +361,6 @@ if (a != null) { displayed = a.isDisplayed(); if (displayed) { - assemble_success1(); break; } @@ -561,10 +551,7 @@ .xpath("//div/ul/li[contains(text(), '" + name + "')]")); - // Wait wait = WaitFactory.createDefaultWait(); - // wait.until(ExpectedConditions.alertIsPresent()); - // Alert alertBox = Utils.driver.switchTo().alert(); - // alertBox.accept(); + isAlertPresent(); Utils.retryingFindAndClick(By.id("save_print")); /** 获取装配成功后的条码 **/ Utils.barcodes = Utils.getToussesBarcodes(); @@ -712,10 +699,7 @@ Utils.retryingFindAndClick(By .xpath("//div/ul/li[contains(text(), '" + name + "')]")); - // Wait wait = WaitFactory.createDefaultWait(); - // wait.until(ExpectedConditions.alertIsPresent()); - // Alert alertBox = Utils.driver.switchTo().alert(); - // alertBox.accept(); + isAlertPresent(); Utils.retryingFindAndClick(By.id("save_print")); /** 获取装配成功后的条码 **/ Utils.barcodes = Utils.getToussesBarcodes(); @@ -968,10 +952,7 @@ Utils.retryingFindAndClick(By .xpath("//div/ul/li[contains(text(), '" + name + "')]")); - // Wait wait = WaitFactory.createDefaultWait(); - // wait.until(ExpectedConditions.alertIsPresent()); - // Alert alertBox = Utils.driver.switchTo().alert(); - // alertBox.accept(); + isAlertPresent(); Utils.retryingFindAndClick(By.id("save_print")); /** 获取装配成功后的条码 **/ Utils.barcodes = Utils.getToussesBarcodes(); @@ -1111,11 +1092,7 @@ name = Utils.settings.getJSONObject("包装类型").getString("名称1"); Utils.retryingFindAndClick(By .xpath("//div/ul/li[contains(text(), '" + name + "')]")); - - // Wait wait = WaitFactory.createDefaultWait(); - // wait.until(ExpectedConditions.alertIsPresent()); - // Alert alertBox = Utils.driver.switchTo().alert(); - // alertBox.accept(); + isAlertPresent(); Utils.retryingFindAndClick(By.id("save_print")); /** 获取装配成功后的条码 **/ Utils.barcodes = Utils.getToussesBarcodes(); @@ -1268,6 +1245,22 @@ } /** + * 判断是否存在alert框 + */ + public void isAlertPresent() { + try { + Wait wait = WaitFactory.createDefaultWait(); + wait.until(ExpectedConditions.alertIsPresent()); + Alert alertBox = Utils.driver.switchTo().alert(); + alertBox.accept(); + Utils.doWait(100); + } catch (NoAlertPresentException e) { + e.printStackTrace(); + AssertJUnit.fail(e.getMessage()); + } + } + + /** * 省医装配扫描配包人和审核人 */ public void scan() { Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/sterilization/SterilizationTest.java =================================================================== diff -u -r18362 -r18662 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/sterilization/SterilizationTest.java (.../SterilizationTest.java) (revision 18362) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/sterilization/SterilizationTest.java (.../SterilizationTest.java) (revision 18662) @@ -171,11 +171,14 @@ // 重新灭菌 // Utils.retryingFindAndDoAction(By.id("iframe_sterilizationRecord"), // Utils.ACTION_SWITCH_TO_FRAME); + Utils.waitPageLoaded(); + Utils.doWait(2000); Utils.retryingFindAndDoAction( By.id(sterilizerName + "-" + SterilizationHelper.炉次_1号高温蒸汽灭菌炉 + "-failureHandle"), Utils.ACTION_CLICK); Utils.driver.switchTo().window(Utils.driver.getWindowHandle()); + Utils.doWait(1000); Utils.retryingFindAndDoAction( By.xpath("//button[contains(text(), '重新灭菌')]"), Utils.ACTION_CLICK); // 他的id是saveBtn