Index: ssts-selenium-test/src/test/java/test_4_1/ALL.java =================================================================== diff -u -r17846 -r17864 --- ssts-selenium-test/src/test/java/test_4_1/ALL.java (.../ALL.java) (revision 17846) +++ ssts-selenium-test/src/test/java/test_4_1/ALL.java (.../ALL.java) (revision 17864) @@ -1,6 +1,5 @@ package test_4_1; -import org.apache.commons.lang3.ObjectUtils; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; @@ -11,11 +10,6 @@ import test.forgon.disinfectsystem.AbstractCSSDTest; import test_4_1.apply.applyConstants.DeskIconEnum; import test_4_1.apply.helper.ApplyHelper; -import test_4_1.apply.service.ApplyComboService; -import test_4_1.apply.service.ApplyComboServiceImpl; -import test_4_1.apply.service.ApplyService; -import test_4_1.apply.service.ApplyServiceImpl; -import test_4_1.apply.service.GdsyApplyServiceImpl; import test_4_1.tools.Utils; /** Index: ssts-selenium-test/src/test/java/test_4_1/Recyle.java =================================================================== diff -u -r17846 -r17864 --- ssts-selenium-test/src/test/java/test_4_1/Recyle.java (.../Recyle.java) (revision 17846) +++ ssts-selenium-test/src/test/java/test_4_1/Recyle.java (.../Recyle.java) (revision 17864) @@ -12,7 +12,6 @@ import org.openqa.selenium.Alert; import org.openqa.selenium.By; -import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; @@ -157,19 +156,7 @@ Utils.retryingFindClickFirstCellOfTable(By .id("awaitForRecycleTable")); // 获取器械包的器械(材料)清单表格 - Wait wait = new FluentWait(Utils.driver) - .withTimeout(5000, TimeUnit.MILLISECONDS) - .pollingEvery(100, TimeUnit.MILLISECONDS) - .ignoring(NoSuchElementException.class) - .ignoring(StaleElementReferenceException.class); - WebElement tousseItemTable = wait - .until(new Function() { - public WebElement apply(WebDriver driver) { - return Utils.retryingFind(By.id("tousseItemTable")); - } - }); - - scanRecycleUserBarcode(tousseItemTable); + WebElement tousseItemTable = scanRecycleUserBarcode(); tousseItemTable.sendKeys(Utils.settings.getJSONObject("一级供应室清洗篮筐4") .getString("条码") + "\n"); @@ -274,20 +261,8 @@ } String recyclingFormWindowhandle = Utils.driver.getWindowHandle(); Utils.driver.switchTo().window(recyclingFormWindowhandle); - // 获取器械包的器械(材料)清单表格 - Wait wait = new FluentWait(Utils.driver) - .withTimeout(5000, TimeUnit.MILLISECONDS) - .pollingEvery(100, TimeUnit.MILLISECONDS) - .ignoring(NoSuchElementException.class) - .ignoring(StaleElementReferenceException.class); - WebElement tousseItemTable = wait - .until(new Function() { - public WebElement apply(WebDriver driver) { - return Utils.retryingFind(By.id("tousseItemTable")); - } - }); - - scanRecycleUserBarcode(tousseItemTable); + + WebElement tousseItemTable = scanRecycleUserBarcode(); tousseItemTable.sendKeys(Utils.settings.getJSONObject("一级供应室清洗篮筐4") .getString("条码") + "\n"); @@ -386,25 +361,10 @@ @Test public void recyle_userRecordApply() { try { - // 获取器械包的器械(材料)清单表格 - Wait wait = new FluentWait(Utils.driver) - .withTimeout(5000, TimeUnit.MILLISECONDS) - .pollingEvery(100, TimeUnit.MILLISECONDS) - .ignoring(NoSuchElementException.class) - .ignoring(StaleElementReferenceException.class); - WebElement tousseItemTable = wait - .until(new Function() { - public WebElement apply(WebDriver driver) { - return Utils.retryingFind(By.id("tousseItemTable")); - } - }); - // 增加休眠,避免扫描后提示条码不符合规范的问题 - + WebElement tousseItemTable = scanRecycleUserBarcode(); tousseItemTable.sendKeys(Utils.settings.getJSONObject("一级供应室清洗篮筐3") .getString("条码") + "\n"); - scanRecycleUserBarcode(tousseItemTable); - // 根据cssClass获取入筐按钮集合 List addButtons = tousseItemTable.findElements(By .cssSelector(".btn-a")); @@ -437,36 +397,9 @@ .id("awaitForRecycleTable")); String recyclingFormWindowhandle = Utils.driver.getWindowHandle(); Utils.driver.switchTo().window(recyclingFormWindowhandle); - // 获取器械包的器械(材料)清单表格 - Wait wait = new FluentWait(Utils.driver) - .withTimeout(5000, TimeUnit.MILLISECONDS) - .pollingEvery(100, TimeUnit.MILLISECONDS) - .ignoring(NoSuchElementException.class) - .ignoring(StaleElementReferenceException.class); - WebElement tousseItemTable = wait - .until(new Function() { - public WebElement apply(WebDriver driver) { - return Utils.retryingFind(By.id("tousseItemTable")); - } - }); + WebElement tousseItemTable = scanRecycleUserBarcode(); tousseItemTable.sendKeys(Utils.settings.getJSONObject("一级供应室清洗篮筐3") .getString("条码") + "\n"); - - // for (String winHandle : Utils.driver.getWindowHandles()) { - // Utils.driver.switchTo().window(winHandle); - // } - // recyclingFormWindowhandle = Utils.driver.getWindowHandle(); - // Utils.driver.switchTo().window(recyclingFormWindowhandle); - // Utils.retryingFind( - // By.xpath("//div/div/button/span[contains(text(), '是')]")) - // .click(); - // (1000); - // for (String winHandle : Utils.driver.getWindowHandles()) { - // Utils.driver.switchTo().window(winHandle); - // } - - scanRecycleUserBarcode(tousseItemTable); - // 根据cssClass获取入筐按钮集合 List addButtons = tousseItemTable.findElements(By .cssSelector(".btn-a")); @@ -587,14 +520,12 @@ try { Utils.retryingFindAndClick(By.linkText("添加")); Thread.sleep(2000); - WebElement recycleForm = Utils.retryingFind(By - .id("recyclingRecordForm")); - - scanRecycleUserBarcode(recycleForm); + WebElement recycleForm = scanRecycleUserBarcode(); // 扫描科室条码 recycleForm.sendKeys(Utils.settings.getJSONObject("临床科室") .getString("条码") + "\n"); boolean displayed = false; + Thread.sleep(1000); String a = Utils.settings.getJSONObject("一级供应室清洗篮筐2").getString( "条码"); @@ -731,19 +662,7 @@ } // 获取器械包的器械(材料)清单表格 - Wait wait = new FluentWait(Utils.driver) - .withTimeout(5000, TimeUnit.MILLISECONDS) - .pollingEvery(250, TimeUnit.MILLISECONDS) - .ignoring(NoSuchElementException.class) - .ignoring(StaleElementReferenceException.class); - WebElement tousseItemTable = wait - .until(new Function() { - public WebElement apply(WebDriver driver) { - return Utils.retryingFind(By.id("tousseItemTable")); - } - }); - - scanRecycleUserBarcode(tousseItemTable); + WebElement tousseItemTable = scanRecycleUserBarcode(); tousseItemTable.sendKeys(Utils.settings.getJSONObject("一级供应室清洗篮筐4") .getString("条码") + "\n"); @@ -773,7 +692,7 @@ Utils.retryingFindAndClick(By.id("ftDefinitionSubmitButton")); - wait = new FluentWait(Utils.driver) + Wait wait = new FluentWait(Utils.driver) .withTimeout(5000, TimeUnit.MILLISECONDS) .pollingEvery(250, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class) @@ -814,19 +733,7 @@ Utils.retryingFindClickFirstCellOfTable(By .id("awaitForRecycleTable")); - // 获取器械包的器械(材料)清单表格 - Wait wait = new FluentWait(Utils.driver) - .withTimeout(5000, TimeUnit.MILLISECONDS) - .pollingEvery(250, TimeUnit.MILLISECONDS) - .ignoring(NoSuchElementException.class) - .ignoring(StaleElementReferenceException.class); - WebElement tousseItemTable = wait - .until(new Function() { - public WebElement apply(WebDriver driver) { - return Utils.retryingFind(By.id("tousseItemTable")); - } - }); - scanRecycleUserBarcode(tousseItemTable); + WebElement tousseItemTable = scanRecycleUserBarcode(); tousseItemTable.sendKeys(Utils.settings.getJSONObject("一级供应室清洗篮筐4") .getString("条码") + "\n"); @@ -862,7 +769,7 @@ frame = Utils.retryingFindAndSwitchToFrame(By.id("xubox_iframe")); Utils.retryingFindAndClick(By.id("ftDefinitionSubmitButton")); - wait = new FluentWait(Utils.driver) + Wait wait = new FluentWait(Utils.driver) .withTimeout(5000, TimeUnit.MILLISECONDS) .pollingEvery(250, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class) @@ -1041,22 +948,10 @@ String recyclingFormWindowhandle = Utils.driver.getWindowHandle(); Utils.driver.switchTo().window(recyclingFormWindowhandle); // 获取器械包的器械(材料)清单表格 - Wait wait = new FluentWait(Utils.driver) - .withTimeout(5000, TimeUnit.MILLISECONDS) - .pollingEvery(250, TimeUnit.MILLISECONDS) - .ignoring(NoSuchElementException.class) - .ignoring(StaleElementReferenceException.class); - WebElement tousseItemTable = wait - .until(new Function() { - public WebElement apply(WebDriver driver) { - return Utils.retryingFind(By.id("tousseItemTable")); - } - }); + WebElement tousseItemTable = scanRecycleUserBarcode(); - scanRecycleUserBarcode(tousseItemTable); - Utils.changeCustomWindow(); - wait = new FluentWait(Utils.driver) + Wait wait = new FluentWait(Utils.driver) .withTimeout(5000, TimeUnit.MILLISECONDS) .pollingEvery(250, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class) @@ -1122,27 +1017,31 @@ /** * 省医回收扫描回收人和清点人 */ - public void scanRecycleUserBarcode(WebElement table) { + public WebElement scanRecycleUserBarcode() { + + WebElement table = null; try { + // 扫描回收人条码 String name = Utils.settings.getJSONObject("回收人").getString("条码"); + + table = Utils.retryingFindAndSendKeys(By.id("tousseItemTable"), name + "\n"); - table.sendKeys(name + "\n"); - // for (String winHandle : Utils.driver.getWindowHandles()) { // Utils.driver.switchTo().window(winHandle); // } // String recyclingFormWindowhandle = // Utils.driver.getWindowHandle(); // Utils.driver.switchTo().window(recyclingFormWindowhandle); name = Utils.settings.getJSONObject("清点人").getString("条码"); + + Thread.sleep(1000); // Utils.retryingFind(By.cssSelector("input[value='清点人员']")) // .click(); // 扫描清点人条码 - table.sendKeys(name + "\n"); - + // for (String winHandle : Utils.driver.getWindowHandles()) { // Utils.driver.switchTo().window(winHandle); // } @@ -1154,5 +1053,7 @@ e.printStackTrace(); AssertJUnit.fail(e.getMessage()); } + + return table; } } \ No newline at end of file