Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/testscript/TestWash.java =================================================================== diff -u -r33782 -r33785 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/testscript/TestWash.java (.../TestWash.java) (revision 33782) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/testscript/TestWash.java (.../TestWash.java) (revision 33785) @@ -59,7 +59,6 @@ personalDesktopProxy.go_wash(); //清洗 String result= washProxy.disinfect_by_select_options(disinfectMachineName, disinfectProgram, operator.getString("barcode"), basketBarcodes); - System.out.println(result); Assert.assertTrue(result.contains(expect)); } @@ -78,7 +77,6 @@ //清洗 personalDesktopProxy.go_wash(); String result= washProxy.disinfect_by_scan_barcodes(disinfectMachineBarcode, disinfectProgramBarcode, operator.getString("barcode"), basketBarcodes); - System.out.println(result); Assert.assertTrue(result.contains(expect)); } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/recycle/RecyclePage.java =================================================================== diff -u -r33782 -r33785 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/recycle/RecyclePage.java (.../RecyclePage.java) (revision 33782) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/recycle/RecyclePage.java (.../RecyclePage.java) (revision 33785) @@ -32,23 +32,23 @@ * @return */ public WebElement get_all_into_basket_btn(){ - return get_element(this.allIntoBasketBtn); + return get_element_until_clickable(this.allIntoBasketBtn); } /** * 获取回收项表格 * @return */ public WebElement get_tousse_tousse_item_table(){ - return get_element(this.tousseItemTable); + return get_element_until_visibility(this.tousseItemTable); } /** * 获取保存按钮 * @return */ public WebElement get_save_btn(){ - return get_element(this.saveBtn); + return get_element_until_clickable(this.saveBtn); } /** Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/recycle/AwaitForRecycleProxy.java =================================================================== diff -u -r33782 -r33785 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/recycle/AwaitForRecycleProxy.java (.../AwaitForRecycleProxy.java) (revision 33782) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/recycle/AwaitForRecycleProxy.java (.../AwaitForRecycleProxy.java) (revision 33785) @@ -1,5 +1,7 @@ package test.forgon.disinfectsystem.selenium3.page.recycle; +import io.qameta.allure.Step; + /** * 待回收页面业务层 * @author yuandongxiao @@ -13,6 +15,7 @@ * 根据申请单类型选择最近的一张申请单 * @param appType */ + @Step("根据申请单类型选择最近的一张申请单") public void choose_most_recent_application_by_type(String appType){ awaitForRecycleHandle.select_app_type_by_visible_text(appType); awaitForRecycleHandle.click_last_modified_time(); Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/recycle/AwaitForRecyclePage.java =================================================================== diff -u -r33782 -r33785 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/recycle/AwaitForRecyclePage.java (.../AwaitForRecyclePage.java) (revision 33782) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/recycle/AwaitForRecyclePage.java (.../AwaitForRecyclePage.java) (revision 33785) @@ -20,23 +20,23 @@ * @return */ public WebElement get_app_type_select(){ - return get_element(this.appTypeSelect); + return get_element_until_clickable(this.appTypeSelect); } /** * 获取最后修改时间 * @return */ public WebElement get_last_modified_time(){ - return get_element(this.lastModifiedTime); + return get_element_until_clickable(this.lastModifiedTime); } /** * 获取待回收列表的第一张申请单记录 * @return */ public WebElement get_first_application_in_await_for_recycle_table(){ - return get_element(this.firstApplicationInAwaitForRecycleTable); + return get_element_until_clickable(this.firstApplicationInAwaitForRecycleTable); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/personaldesktop/PersonalDesktopPage.java =================================================================== diff -u -r33782 -r33785 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/personaldesktop/PersonalDesktopPage.java (.../PersonalDesktopPage.java) (revision 33782) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/personaldesktop/PersonalDesktopPage.java (.../PersonalDesktopPage.java) (revision 33785) @@ -24,7 +24,7 @@ * @return */ public WebElement get_welcome_lable(){ - return get_element(this.welcomeLable); + return get_element_until_visibility(this.welcomeLable); } /** @@ -40,46 +40,46 @@ * @return */ public WebElement get_exit_btn(){ - return get_element(this.exitBtn); + return get_element_until_clickable(this.exitBtn); } /** * 获取科室申领图标 * @return */ public WebElement get_apply_icon(){ - return get_element(this.applyIcon); + return get_element_until_clickable(this.applyIcon); } /** * 获取科室申领标签页 * @return */ public WebElement get_apply_frame(){ - return get_element(this.applyFrame); + return get_element_until_visibility(this.applyFrame); } /** * 获取回收清点图标 * @return */ public WebElement get_recycle_icon(){ - return get_element(this.recycleIcon); + return get_element_until_clickable(this.recycleIcon); } /** * 获取清洗消毒图标 * @return */ public WebElement get_wash_icon(){ - return get_element(this.washIcon); + return get_element_until_clickable(this.washIcon); } /** * 获取清洗消毒标签页 * @return */ public WebElement get_wash_frame(){ - return get_element(this.washFrame); + return get_element_until_visibility(this.washFrame); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/personaldesktop/PersonalDesktopProxy.java =================================================================== diff -u -r33782 -r33785 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/personaldesktop/PersonalDesktopProxy.java (.../PersonalDesktopProxy.java) (revision 33782) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/personaldesktop/PersonalDesktopProxy.java (.../PersonalDesktopProxy.java) (revision 33785) @@ -61,7 +61,7 @@ /** * 点击跳转到清洗消毒标签页 */ - @Step("点击跳转到科室申领标签页") + @Step("点击跳转到清洗消毒标签页") public void go_wash(){ personalDesktopHandle.click_wash_icon(); personalDesktopHandle.switch_to_wash_frame(); Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/basepage/BasePage.java =================================================================== diff -u -r33782 -r33785 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/basepage/BasePage.java (.../BasePage.java) (revision 33782) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/basepage/BasePage.java (.../BasePage.java) (revision 33785) @@ -20,11 +20,11 @@ public static Logger logger = Logger.getLogger(BasePage.class); /** - * 通过显式等待定位元素(单个元素) + * 显式等待:元素可看见则返回 * @param locator * @return */ - public WebElement get_element(By locator){ + public WebElement get_element_until_visibility(By locator){ //设置显式等待时间 WebDriverWait wait = new WebDriverWait(Utils.driver,10); //通过显式等待定位元素 @@ -34,10 +34,24 @@ } /** - * 通过显式等待定位元素(多个元素) + * 显式等待:元素可点击则返回 * @param locator * @return */ + public WebElement get_element_until_clickable(By locator){ + //设置显式等待时间 + WebDriverWait wait = new WebDriverWait(Utils.driver,10); + //通过显式等待定位元素 + WebElement element = wait.until(ExpectedConditions.elementToBeClickable(locator)); + logger.debug("定位元素:"+locator+"成功!"); + return element; + } + + /** + * 显式等待多个元素:元素可看见则返回 + * @param locator + * @return + */ public List get_elements(By locator){ //设置显式等待时间 WebDriverWait wait = new WebDriverWait(Utils.driver,10); @@ -48,7 +62,7 @@ } /** - * 通过强制等待及显式等待定位组合框选项 + * 通过强制等待及显式等待定位组合框选项:元素可点击则返回 * @param comboInputText * @return */ @@ -64,7 +78,7 @@ //设置显式等待时间 WebDriverWait wait = new WebDriverWait(Utils.driver,10); //通过显式等待定位元素 - WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(comboOption)); + WebElement element = wait.until(ExpectedConditions.elementToBeClickable(comboOption)); logger.debug("定位元素:"+comboOption+"成功!"); return element; } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/apply/ApplyPage.java =================================================================== diff -u -r33782 -r33785 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/apply/ApplyPage.java (.../ApplyPage.java) (revision 33782) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/apply/ApplyPage.java (.../ApplyPage.java) (revision 33785) @@ -29,47 +29,47 @@ * @return */ public WebElement get_apply_combo_btn(){ - return get_element(this.applyComboBtn); + return get_element_until_clickable(this.applyComboBtn); } /** * 获取元素:申请器械包按钮 * @return */ public WebElement get_apply_tousse_btn(){ - return get_element(this.applyTousseBtn); + return get_element_until_clickable(this.applyTousseBtn); } /** * 获取元素:处理科室 * @return */ public WebElement get_handle_depart(){ - return get_element(this.handleDepart); + return get_element_until_clickable(this.handleDepart); } /** * 获取元素:物品名称 * @return */ public WebElement get_tousse_name(){ - return get_element(this.tousseName); + return get_element_until_clickable(this.tousseName); } /** * 获取元素:申请数量 * @return */ public WebElement get_apply_count(){ - return get_element(this.applyCount); + return get_element_until_clickable(this.applyCount); } /** * 获取元素:添加按钮 * @return */ public WebElement get_add_tousse_btn(){ - return get_element(this.addTousseBtn); + return get_element_until_clickable(this.addTousseBtn); } /** @@ -95,15 +95,15 @@ * @return */ public WebElement get_commit_btn(){ - return get_element(this.commitBtn); + return get_element_until_clickable(this.commitBtn); } /** * 获取元素:确认提交按钮“是” * @return */ public WebElement get_commit_confirm_btn(){ - return get_element(this.commitConfirmBtn); + return get_element_until_clickable(this.commitConfirmBtn); } /** Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/wash/WashPage.java =================================================================== diff -u -r33782 -r33785 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/wash/WashPage.java (.../WashPage.java) (revision 33782) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/wash/WashPage.java (.../WashPage.java) (revision 33785) @@ -25,15 +25,15 @@ * @return */ public WebElement get_add_btn(){ - return get_element(this.addBtn); + return get_element_until_clickable(this.addBtn); } /** * 获取清洗机名称输入框 * @return */ public WebElement get_disinfect_machine_name(){ - return get_element(this.disinfectMachineName); + return get_element_until_clickable(this.disinfectMachineName); } /** @@ -43,15 +43,15 @@ */ public WebElement get_disinfect_machine_option(String disinfectMachineName){ By disinfectMachineOption = By.xpath("//div[contains(text(),'"+disinfectMachineName+"')]");//清洗机选项定位 - return get_element(disinfectMachineOption); + return get_element_until_clickable(disinfectMachineOption); } /** * 获取清洗程序输入框 * @return */ public WebElement get_disinfect_program(){ - return get_element(this.disinfectProgram); + return get_element_until_clickable(this.disinfectProgram); } /** @@ -61,23 +61,23 @@ */ public WebElement get_disinfect_program_option(String disinfectProgram){ By disinfectProgramOption = By.xpath("//div[contains(text(),'"+disinfectProgram+"')]");//清洗程序选项定位 - return get_element(disinfectProgramOption); + return get_element_until_clickable(disinfectProgramOption); } /** * 获取扫描条码输入框 * @return */ public WebElement get_scan_barcode(){ - return get_element(this.scanBarcode); + return get_element_until_clickable(this.scanBarcode); } /** * 获取保存按钮 * @return */ public WebElement get_save_btn(){ - return get_element(this.saveBtn); + return get_element_until_clickable(this.saveBtn); } /** @@ -87,7 +87,7 @@ */ public WebElement get_load_basket_btn(String basketBarcode){ By loadBasketBtn = By.xpath("//img[contains(@onclick,'"+basketBarcode+"')]");//篮筐对应的载入按钮 - return get_element(loadBasketBtn); + return get_element_until_clickable(loadBasketBtn); } /** @@ -97,6 +97,5 @@ public WebElement get_save_tip(){ List saveTipList = get_elements(this.saveTip); return saveTipList.get(saveTipList.size()-1); -// return get_element(this.saveTip); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/login/LoginPage.java =================================================================== diff -u -r33782 -r33785 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/login/LoginPage.java (.../LoginPage.java) (revision 33782) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium3/page/login/LoginPage.java (.../LoginPage.java) (revision 33785) @@ -22,7 +22,7 @@ * @return */ public WebElement get_username(){ - return get_element(this.username); + return get_element_until_clickable(this.username); } /** @@ -31,7 +31,7 @@ * @return */ public WebElement get_password(){ - return get_element(this.password); + return get_element_until_clickable(this.password); } /** @@ -40,14 +40,14 @@ * @return */ public WebElement get_login_btn(){ - return get_element(this.loginBtn); + return get_element_until_clickable(this.loginBtn); } /** * 获取元素:登录提示信息 * @return */ public WebElement get_tip(){ - return get_element(this.tip); + return get_element_until_visibility(this.tip); } }