Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/tools/JSWaiter.java =================================================================== diff -u -r19406 -r19666 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/tools/JSWaiter.java (.../JSWaiter.java) (revision 19406) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/tools/JSWaiter.java (.../JSWaiter.java) (revision 19666) @@ -34,8 +34,7 @@ .withTimeout(20000, TimeUnit.MILLISECONDS) .pollingEvery(250, TimeUnit.MILLISECONDS) .ignoring(JavascriptException.class); - - + jsExec = (JavascriptExecutor) jsWaitDriver; } @@ -48,11 +47,10 @@ // Get JQuery is Ready boolean jqueryReady = false; // 捕获JavascriptException异常 - try{ + try { jqueryReady = (Boolean) jsExec .executeScript("return jQuery.active==0"); - } - catch(JavascriptException e){ + } catch (JavascriptException e) { e.printStackTrace(); logger.debug(e.getMessage()); } @@ -62,7 +60,7 @@ // Wait for jQuery to load jsWait.until(jQueryLoad); } else { -// logger.debug("JQuery is Ready!"); + // logger.debug("JQuery is Ready!"); } } @@ -122,10 +120,11 @@ // Wait Javascript until it is Ready! if (!jsReady) { logger.debug("JS is NOT Ready!"); + Utils.refresh(); // Wait for Javascript to load wait.until(jsLoad); } else { -// logger.debug("JS is Ready!"); + // logger.debug("JS is Ready!"); } } @@ -140,11 +139,10 @@ // First check that JQuery is defined on the page. If it is, then wait // AJAX Boolean jQueryDefined = false; - try{ + try { jQueryDefined = (Boolean) jsExec .executeScript("return typeof jQuery != 'undefined'"); - } - catch(JavascriptException e){ + } catch (JavascriptException e) { e.printStackTrace(); logger.debug(e.getMessage()); } @@ -160,7 +158,7 @@ sleep(50); break; } else { -// logger.debug("jQuery is not defined on this site!"); + // logger.debug("jQuery is not defined on this site!"); sleep(50); continue; } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/sterilization/SterilizationTest.java =================================================================== diff -u -r19544 -r19666 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/sterilization/SterilizationTest.java (.../SterilizationTest.java) (revision 19544) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/sterilization/SterilizationTest.java (.../SterilizationTest.java) (revision 19666) @@ -119,10 +119,14 @@ Utils.retryingFindAndSwitchToFrame(By .id("iframe_sterilizationRecord")); // Utils.doWait(500); - Utils.retryingFindAndSendKeys(By.id("formName"), Keys.DOWN); - // TODO: 下拉框没选择值 - Utils.retryingFindAndClick(By - .xpath("//div[contains(text(), '灭菌失败事件')]")); + JSWaiter.waitUntilJQueryReady(); + if (Utils.isFind(Utils.retryingFind(By.id("formName")))) { + Utils.retryingFindAndSendKeys(By.id("formName"), Keys.DOWN); + // TODO: 下拉框没选择值 + JSWaiter.waitUntilJQueryReady(); + Utils.retryingFindAndClick(By + .xpath("//div/div/div[contains(text(), '灭菌失败事件')]")); + } Utils.retryingFindAndSendKeys(By.id("tempBarcode"), notEntryBasketTousseBarcods.get(0) + "\n"); Utils.retryingFindAndClick(By.id("recycle")); @@ -168,7 +172,7 @@ Utils.retryingFindAndSendKeys(By.id("formName"), Keys.DOWN); Utils.retryingFindAndClick(By - .xpath("//div[contains(text(), '灭菌失败事件')]")); + .xpath("//div/div/div[contains(text(), '灭菌失败事件')]")); Utils.retryingFindAndSendKeys(By.id("tempBarcode"), tempBarcode + "\n"); Utils.retryingFindAndClick(By.id("repacking")); Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Reject.java =================================================================== diff -u -r19572 -r19666 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Reject.java (.../Reject.java) (revision 19572) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Reject.java (.../Reject.java) (revision 19666) @@ -9,6 +9,7 @@ import org.openqa.selenium.Keys; import org.openqa.selenium.os.WindowsUtils; +import test.forgon.disinfectsystem.selenium.tools.JSWaiter; import test.forgon.disinfectsystem.selenium.tools.Utils; /** @@ -52,6 +53,7 @@ By.xpath("//button[contains(text(), '一次性物品退货')]")); String currentwindowhandle = Utils.driver.getWindowHandle(); Utils.driver.switchTo().window(currentwindowhandle); + JSWaiter.waitUntilJQueryReady(); Utils.retryingFindAndSendKeys(By.id("depart"),Keys.DOWN); String name = Utils.settings.getJSONObject("临床科室").getString("名称");