7

来源:互联网 发布:c语言学生管理系统 编辑:程序博客网 时间:2024/04/30 20:03
}/** * TOPN *  * @author zKF54587 */public static void aw_setTopn(String topnValue) {AW_SeleniumMethod.aw_setTextByID(MaintenancesopLoc.topnId, topnValue);}/** * 保存为草根 *  * @author zKF54587 */public static void aw_saveDraft() {AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.saveDraftId);boolean bRet = AW_SeleniumMethod.aw_IsTestPresent("保存成功");AW_SeleniumMethod.aw_keyPressNative(KeyEvent.VK_ENTER);Assert.assertTrue(bRet);}/** * 获取报告汇总页面的任务列表显示的所有任务 *  * @author zKF54587 */public static void aw_EnterReportSummaryTaskEnterfaceByTaskId(PeculiarityLocator peculiarityLocator, String taskId) {// 进入任务管理页面AW_SeleniumMethod.aw_LeftSingleClickByID("sopReportCollectPanel");// 检查任务是否新建成功// 刷新任务列表// AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.refreshTaskInfoOnReportCollectXpath);String taskInfo = AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.taskInfoTableId).trim();String[] taskInfoList = taskInfo.split("\n");for (int i = 0, j = 2; i < taskInfoList.length; i += 9, j++) {if (taskInfoList[i].trim().equals(taskId)) {System.out.println(MaintenancesopLoc.taskInfoLineLocXpath+ "tr[" + j + "]/td[2]/div");AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.taskInfoLineLocXpath+ "tr[" + j + "]/td[2]/div");break;}}}/** * 获取报告汇总页面的任务列表显示的所有任务 *  * @author zKF54587 */public static boolean aw_IsReprotColectTaskSuc(PeculiarityLocator peculiarityLocator, String taskId) {// 进入任务管理页面AW_SeleniumMethod.aw_LeftSingleClickByID("sopReportCollectPanel");// 检查任务是否新建成功// 刷新任务列表String taskInfo = AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.taskInfoTableId).trim();String[] taskInfoList = taskInfo.split("\n");boolean bRet = false;int i = 0;while (true) {AW_SeleniumMethod.aw_sleep(3);taskInfoList = AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.taskInfoTableId).trim().split("\n");for (i = 0; i < taskInfoList.length; i += 9) {// System.out.println("taskdetail:" +// taskInfoList[i].trim()+taskInfoList[i+1] );if (taskInfoList[i].trim().equals(taskId)) {if (taskInfoList[i + 1].equals("成功")) {bRet = true;return bRet;} else if (taskInfoList[i + 1].equals("失败")) {bRet = false;return bRet;}}}}}/** * SOP汇总任务报告下载 *  * @author zKF54587 */public static void aw_SOPCollectReportDownload(PeculiarityLocator peculiarityLocator, String savepath) {// 进入任务管理页面AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.sopCollectReportListGheckXpath);AW_FileHandle.file_downloadById(MaintenancesopLoc.SopCollectReportDwnloadBtnId, savepath);}/** * sop维护流程子页签进入 *  * @author j00129746 */public static void aw_EnterSOPFlowPage(String labeltext) {if (labeltext.equals("首页")) {AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.SOPFlowNavaationPanleStep1Id);} else if (labeltext.equals("数据采集")) {AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.SOPFlowNavaationPanleStep2Id);} else if (labeltext.equals("填写信息")) {AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.SOPFlowNavaationPanleStep3Id);} else if (labeltext.equals("数据上传")) {AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.SOPFlowNavaationPanleStep4Id);} else if (labeltext.equals("获取报告")) {AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.SOPFlowNavaationPanleStep5Id);}}/** * 获取任务列表显示的所有任务 *  * @author zKF54587 */public static void aw_EnterSpecificTab(PeculiarityLocator peculiarityLocator, String tabText) {// 进入任务管理页面AW_CommonOperate.aw_enterFunctionPage(peculiarityLocator, tabText);}/** * 点击SOP任务提交按钮 *  * @author zKF54587 */public static void aw_ClickSOPTaskSummitBtn() {// 进入任务管理页面AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.SOPTASKSubmitBtnId);}/** * 任务重试(报告汇总页面) *  * @author zKF54587 * */public static boolean aw_failTaskRetryOnReportCollect(PeculiarityLocator peculiarityLocator, String taskId) {// 根据任务号查询任务在任务列表中的位置int taskIndex = AW_TaskManageOperate.aw_getIndexByTaskId(peculiarityLocator, taskId);// 选重任务AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.taskInfoLineLocXpath+ "/tr[" + taskIndex + "]/td[1]/div");// 点击任务重试按钮AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.taskRetryBtnOnReportCollectId);// 检查任务状态是否为重试后的任务状态String taskInfo = AW_TaskManageOperate.aw_getTaskInfoByTaskId(peculiarityLocator, taskId);// 判断任务重试是否成功boolean retryResult = false;if (taskInfo.equals("排队中") || taskInfo.equals("数据处理中")) {// 点击当前状态,查看网元状态String[] taskInfoList = AW_TaskManageOperate.aw_examineTaskstatusInfo(peculiarityLocator, taskId);// 任务在排队中时,网元状态”就绪“;任务状态在数据处理中时,网元状态是”就绪“,”执行检查项“,等,网元状态需要确认for (int i = 0; i < taskInfoList.length; i++) {}return retryResult;} else {return retryResult;}}/** * 报告汇总页面,清空网元 *  * @author zKF54587 */public static void aw_clearNeversionOnReportCollect() {AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.clearNeversionBtnId);}/** * 报告汇总页面,清空网元 *  * @author zKF54587 */public static void aw_ClickSubmitReportCollect() {AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.collectTaskSubmitBtnId);}/** * 报告汇总页面,清空网元 *  * @author zKF54587 */public static String aw_getSelectedNeversionOnReportCollect() {// 获取所有已选择的需要汇总的任务信息String selectecCollectTaskInfo = AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.selectedCollectTaskId);return selectecCollectTaskInfo;}/** * 维护SOP流程验证 *  * @author zKF54587 */public static boolean aw_maintenancesopFlowValidate() {boolean isOK = true;// 首页isOK = AW_CommonOperate.aw_nevFlowValidate(MaintenancesopLoc.sopNevFlowFirstSheetXpath,MaintenancesopLoc.sopNevFlowAbstractId,Var_NetNevParam.sopNevFlowAnstract);// 数据采集isOK = AW_CommonOperate.aw_nevFlowValidate(MaintenancesopLoc.sopNevDataCollectXpath,MaintenancesopLoc.sopNevDateCollectContentId,Var_NetNevParam.sopPrapareContent);// 填写信息AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.sopNevFlowFillInfoXpath);String nevInfoWrite = AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.sopInfoWriteId);if (!nevInfoWrite.equals(Var_NetNevParam.sopInfoWrite)) {isOK = false;}// 数据上传AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.sopNevFlowDataUploadXpath);String nevDataUploadRule = AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.sopDataUploadRuleId);if (!nevDataUploadRule.equals(Var_NetNevParam.sopDataUploadRule)) {isOK = false;}// 获取报告AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.netNevFlowGetReportXpath);String nevGetReport = AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.nevReportDownLoadExplainId);String deliverDirection = AW_SeleniumMethod.aw_getTextbyXpath(MaintenancesopLoc.deliverDirectionXpath);if (!nevGetReport.equals(Var_NetNevParam.sopReportDownloadExplain)|| !deliverDirection.equals(Var_NetNevParam.sopDeliverDirection)) {isOK = false;}return isOK;}// 只有一个工程包时,只勾选第一个检查项public static void aw_selectFirstCheckItemOnPrjPackage() {// 展开工程包下面的检查项AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.openOutPrjPackage);// 却掉所有检查项的勾选AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.selectPrjPackageContent);// 勾选第一个检查项AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.firstCheckItemPrjPackage);}// 只有一个工程包时,只勾所有检查项public static void aw_selectAllCheckItemOnPrjPackage() {// 展开工程包下面的检查项AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.openOutPrjPackage);// 却掉所有检查项的勾选AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.selectPrjPackageContent);// 勾选所有检查项AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.selectPrjPackageContent);}/** * 操作下一步按钮,进入SOP任务创建界面 *  * @param operateType *            业务类型 * @author zKF54587 * @time 2013/7/12 */public static void enterSOPinterface() {AW_CommonOperate.aw_enterPeculiarityPage("维护SOP");}/** * 操作下一步按钮,退出SOP任务创建界面 *  * @param operateType *            业务类型 * @author zKF54587 * @time 2013/7/12 */public static void quitSOPinterface() {AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.SOPCloseXpath);Assert.assertTrue(AW_SeleniumMethod.aw_IsTestPresent("请确认是否关闭 \"维护SOP\" 窗体?"));AW_SeleniumMethod.aw_keyPressNative(KeyEvent.VK_ENTER);}/** * 操作下一步按钮,进入SOP任务创建界面 *   * @param operateType *            业务类型 * @author zKF54587 * @time 2013/7/12 */public static void taskInfoBtnClick() {AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.SOPTaskReportInfoXPath);}/** * 给定任务进行数据上传后自动提交,成功后返回false *  * @author 赵锐平 */public static boolean uploaddataAutoSummit(String datapath) {AW_SeleniumMethod.aw_sleep(90);String windowHandle = driver.getWindowHandle();WebDriver newwindow = AW_SeleniumMethod.aw_switchtoNewWindow(Var_NetworkOptimize.UploadDataTitle);newwindow.manage().window().maximize();AW_SeleniumMethod.aw_sleep(10);// 设置任务自动提交AW_FileUpload.aw_AutoSummitBtn();// 上传数据AW_FileUpload.aw_uploadTestDataToDataCenter(datapath);// boolean bRet =// AW_NetWorkOptimize.isUploaddataWindowPresent(newwindow);boolean bRet = AW_SeleniumMethod.aw_isWindowPresentBytitle(Var_NetworkOptimize.UploadDataTitle);int delay = 0;// 判断数据上传窗口是否消失while (true) {// 判断数据上传窗口bRet = AW_SeleniumMethod.aw_isWindowPresentBytitle(Var_NetworkOptimize.UploadDataTitle);AW_SeleniumMethod.aw_sleep(10);delay++;if (!bRet || delay > 30 * 60 / 10) {break;}}// 切换到主窗口AW_SeleniumMethod.aw_swithtoWindow(windowHandle);return bRet;}/** * 给定任务进行数据上传后自动提交,成功后返回false *  * @author 赵锐平 */public static boolean uploaddataAutoSummitForLTE(String datapath) {AW_SeleniumMethod.aw_sleep(110);String windowHandle = driver.getWindowHandle();WebDriver newwindow = AW_SeleniumMethod.aw_switchtoNewWindow(Var_NetworkOptimize.UploadDataTitle);newwindow.manage().window().maximize();AW_SeleniumMethod.aw_sleep(10);// 设置任务自动提交AW_FileUpload.aw_AutoSummitBtn();// 上传数据AW_FileUpload.aw_uploadTestDataToDataCenterForSOPLTE(datapath);// boolean bRet =// AW_NetWorkOptimize.isUploaddataWindowPresent(newwindow);boolean bRet = AW_SeleniumMethod.aw_isWindowPresentBytitle(Var_NetworkOptimize.UploadDataTitle);int delay = 0;// 判断数据上传窗口是否消失while (true) {// 判断数据上传窗口bRet = AW_SeleniumMethod.aw_isWindowPresentBytitle(Var_NetworkOptimize.UploadDataTitle);AW_SeleniumMethod.aw_sleep(10);delay++;if (!bRet || delay > 30 * 60 / 10) {break;}}// 切换到主窗口AW_SeleniumMethod.aw_swithtoWindow(windowHandle);return bRet;}/** * 给定任务进行数据上传后自动提交,成功后返回false *  * @author 赵锐平 */public static boolean uploaddataAutoSummitWithoutPrepocess(String datapath,String netType) {AW_SeleniumMethod.aw_sleep(100);String windowHandle = driver.getWindowHandle();WebDriver newwindow = AW_SeleniumMethod.aw_switchtoNewWindow(Var_NetworkOptimize.UploadDataTitle);newwindow.manage().window().maximize();AW_SeleniumMethod.aw_sleep(10);// 设置任务自动提交AW_FileUpload.aw_AutoSummitBtn();// 上传数据if (netType.equals("GSM") || netType.equals("UMTS")|| netType.equals("CDMA")) {AW_FileUpload.aw_uploadTestDataToDataCenterWithoutPrePocess(datapath);} else if (netType.equals("LTE")) {AW_FileUpload.aw_uploadTestDataToDataCenterWithoutPrePocessForLTE(datapath);}// boolean bRet =// AW_NetWorkOptimize.isUploaddataWindowPresent(newwindow);boolean bRet = AW_SeleniumMethod.aw_isWindowPresentBytitle(Var_NetworkOptimize.UploadDataTitle);int delay = 0;// 判断数据上传窗口是否消失while (true) {// 判断数据上传窗口bRet = AW_SeleniumMethod.aw_isWindowPresentBytitle(Var_NetworkOptimize.UploadDataTitle);AW_SeleniumMethod.aw_sleep(10);delay++;if (!bRet || delay > 30 * 60 / 10) {break;}}// 切换到主窗口AW_SeleniumMethod.aw_swithtoWindow(windowHandle);return bRet;}/** * 给定任务执行成功后,进入报告下载页面 *  * @author 赵锐平 */public static void EnterReprotDwnloadInterfaceByTaskId(String taskId,PeculiarityLocator peculiarityLocator) {int nIndextr = 2;int nPos = AW_TaskManageOperate.aw_getIndexByTaskId(peculiarityLocator,taskId);nIndextr += nPos;String taskxpath = "//div[@id='sopTaskManageGridId-body']/div/table/tbody/tr["+ nIndextr + "]/" + "td[2]/div/span";System.out.println(taskxpath);AW_SeleniumMethod.aw_LeftSingleClickByXpath(taskxpath);}/** * 给定任务执行成功后,进入报告下载页面 *  * @author 赵锐平 */public static void SearchTaskByInput(String input) {AW_SeleniumMethod.aw_setTextByID(MaintenancesopLoc.TaskSearchInputId,input);AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.TaskSearchBtnId);}/** * 给定任务执行成功后,进入报告下载页面 *  * @author 赵锐平 */public static String GetReportDwnloadHeadInfo() {return AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.ReportDownloadHeadXpath);}/** * 给定任务执行成功后,报告评价 *  * @author 赵锐平 */public static void SumitReportEstimate(PeculiarityLocator peculiarityLocator, String InputText) {AW_SeleniumMethod.aw_setTextByID(MaintenancesopLoc.SOPReprotTextInputId, InputText);AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.SOPReprotEstimateSumitId);}/** * 给定任务进行数据上传后自动提交,成功后返回false *  * @author 赵锐平 */public static void ReprotDwnloadbyTaskId(String datapath, String taskId,PeculiarityLocator peculiarityLocator) {int nIndextr = 2;int nPos = AW_TaskManageOperate.aw_getIndexByTaskId(peculiarityLocator,taskId);nIndextr += nPos;String taskxpath = "//div[@id='sopTaskManageGridId-body']/div/table/tbody/tr["+ nIndextr + "]/" + "td[2]/div/span";System.out.println(taskxpath);AW_SeleniumMethod.aw_LeftSingleClickByXpath(taskxpath);AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.FisrtReprotXpath);AW_FileHandle.file_downloadById(MaintenancesopLoc.DwnLoadBtnId,datapath);}/** * 根据任务号删除指定任务 *  * @author 焦媛 */public static void DelTaskByTaskId(String taskId,PeculiarityLocator peculiarityLocator) {int nIndextr = 2;int nPos = AW_TaskManageOperate.aw_getIndexByTaskId(peculiarityLocator,taskId);if (-1 == nPos) {return;}nIndextr += nPos;String taskxpath = "//div[@id='sopTaskManageGridId-body']/div/table/tbody/tr["+ nIndextr + "]/" + "td[1]/div";System.out.println(taskxpath);AW_SeleniumMethod.aw_LeftSingleClickByXpath(taskxpath);AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.DelTaskBtnId);}/** * 根据任务号删除指定任务 *  * @author 焦媛 */public static void ClickTaskStatusByTaskId(String taskId,PeculiarityLocator peculiarityLocator) {int nIndextr = 2;int nPos = AW_TaskManageOperate.aw_getIndexByTaskId(peculiarityLocator,taskId);if (-1 == nPos) {return;}nIndextr += nPos;String taskStatusxpath = "//div[@id='sopTaskManageGridId-body']/div/table/tbody/tr["+ nIndextr + "]/" + "td[3]/div/span";System.out.println("taskstatusxpathL" + taskStatusxpath);AW_SeleniumMethod.aw_LeftSingleClickByXpath(taskStatusxpath);}/** * 根据任务号删除指定任务 *  * @author 焦媛 */public static String GetTaskStatusInfo(PeculiarityLocator peculiarityLocator) {return AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.SOPTaskStausWindowId);}/** * 根据任务号删除指定任务 *  * @author 焦媛 */public static void CloseTaskStatusInfoWindow(PeculiarityLocator peculiarityLocator) {AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.CloseSOPTaskStausWindowXpath);}/** * 获取删除按钮状态 *  * @author 焦媛 */public static boolean getTaskDelBtnStatus(PeculiarityLocator peculiarityLocator) {return AW_SeleniumMethod.aw_isEnablebyId(MaintenancesopLoc.DelTaskBtnId);}/** * 获取任务充实按钮状态 *  * @author 焦媛 */public static boolean getTaskRetryBtnStatus(PeculiarityLocator peculiarityLocator) {return AW_SeleniumMethod.aw_isEnablebyId(MaintenancesopLoc.RetryTaskBtnId);}/** * 选中指定任务 *  * @author 焦媛 */public static void SelectTaskByTaskId(String taskId,PeculiarityLocator peculiarityLocator) {int nIndextr = 2;int nPos = AW_TaskManageOperate.aw_getIndexByTaskId(peculiarityLocator,taskId);nIndextr += nPos;String taskxpath = "//div[@id='sopTaskManageGridId-body']/div/table/tbody/tr["+ nIndextr + "]/" + "td[1]/div/div";System.out.println(taskxpath);AW_SeleniumMethod.aw_LeftSingleClickByXpath(taskxpath);}/** * 根据指定的任务号,查看任务在任务列表中的位置 *  * @author zKF54587 */public static void aw_ClickThreadValueBtn() {AW_SeleniumMethod.aw_LeftSingleClickByXpath(MaintenancesopLoc.ThreadValueCheckXpath);}/** * 根据指定的任务号,查看任务在任务列表中的位置 *  * @author zKF54587 */public static void aw_TreadValueSearch(String SearchName) {// 输入查询字段AW_SeleniumMethod.aw_setTextByID(MaintenancesopLoc.SOThreadSearchInputId, SearchName);// 点击查询AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.SOThreadSearchBtnId);}/** * 根据指定的门限名称,查看门限在表中的位置 *  * @author j00129746 */public static int aw_getIndexByThreadItemName(String ItemName) {int taskIndex = -1;String taskInfo = AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.SOPThreadTableBodyId);while (!taskInfo.contains("平均占用率门限")) {AW_SeleniumMethod.aw_sleep(1);taskInfo = AW_SeleniumMethod.aw_getTextbyID(MaintenancesopLoc.SOPThreadTableBodyId);}String[] taskInfoList = taskInfo.split("\n");for (String string : taskInfoList) {System.out.println("string: " + string);}for (int i = 6; i < taskInfoList.length; i += 8) {if (taskInfoList[i + 3].equals(ItemName)) {taskIndex = i / 8;taskIndex += 1;break;}}return taskIndex;}/** * 给定任务进行数据上传后自动提交,成功后返回false *  * @author 赵锐平 */public static void SetThreadValue(String itemName, String itemvalue) {AW_MaintenanceSopOperator.aw_TreadValueSearch(itemName);String taskxpath = "//div[@id='sopThresholdGridId-body']/div/table/tbody/tr[2]/"+ "td[5]/div";System.out.println(taskxpath);AW_SeleniumMethod.aw_doubleclickbyXpath(taskxpath);AW_SeleniumMethod.aw_sleep(5);for (int i = 0; i <= 5; i++) {AW_SeleniumMethod.aw_keyPressNative(KeyEvent.VK_DELETE);}AW_SeleniumMethod.aw_keyboardinput(itemvalue);AW_SeleniumMethod.aw_keyPressNative(KeyEvent.VK_ENTER);}/** * 门限设置后点击确定 *  * @author 焦媛 */public static void ClickThreadValueSureBtn() {AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.SOPThreadSureBtnId);}/** * 门限设置后点击取消 *  * @author 焦媛 */public static void ClickThreadValueCancelBtn() {AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.SOPThreadCancleBtnId);}/** * 报告汇总按正式过滤 *  * @author 焦媛 */public static void SummaryFilterByNettypeGSM() {AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.SOPSummerFilterNetworkId);AW_SeleniumMethod.aw_keyPressNative(KeyEvent.VK_ENTER);AW_SeleniumMethod.aw_LeftSingleClickByID(MaintenancesopLoc.SOPSummerFilterBtnId);}/** * 获取创建任务的taskId */public static String aw_getCreateTaskId(final PeculiarityLocator peculiarityLocator) {return new WebDriverWait(driver, 100).until(new ExpectedCondition<WebElement>() {@Overridepublic WebElement apply(WebDriver arg0) {return arg0.findElement(By.id(peculiarityLocator.TaskIdCreateTaskId));}}).getText();}/** *  */}]]></File>  <File type=".java" path="D:\OneMbps\st\com\huawei\genex\st\genexspace\aw\mrnev\AW_MrNevOperator.java" name="AW_MrNevOperator.java"><![CDATA[package com.huawei.genex.st.genexspace.aw.mrnev;import java.awt.event.KeyEvent;import org.openqa.selenium.WebDriver;import org.testng.Assert;import com.huawei.genex.st.genexspace.aw.commonoperate.AW_ModuleOperate;import com.huawei.genex.st.genexspace.aw.commonoperate.AW_TaskManageOperate;import com.huawei.genex.st.genexspace.aw.currency.AW_CommonOperate;import com.huawei.genex.st.genexspace.aw.currency.AW_FileHandle;import com.huawei.genex.st.genexspace.aw.currency.AW_FileUpload;import com.huawei.genex.st.genexspace.aw.currency.AW_SeleniumMethod;import com.huawei.genex.st.genexspace.locatorxpath.maintenancesop.MaintenancesopLoc;import com.huawei.genex.st.genexspace.locatorxpath.mr.MRNevaluationLoc;import com.huawei.genex.st.genexspace.locatorxpath.operationxpath.PeculiarityLocator;import com.huawei.genex.st.genexspace.variable.basic.Var_BasicOperateObject;import com.huawei.genex.st.genexspace.variable.common.Var_CommonParam;import com.huawei.genex.st.genexspace.variable.networkoptimize.Var_NetworkOptimize;public class AW_MrNevOperator extends Var_BasicOperateObject{/** * @function 新建任务第一个页面 暂时不包括重用历史数据的功能 * @author rKF74816 * @time 2013/10/21 */public static void aw_TaskBasicInfo_CreateTask(PeculiarityLocator peculiarityLocator, Var_CommonParam commonParam) {// 设置运营商数据AW_ModuleOperate.aw_setOperateDatas(peculiarityLocator, commonParam);// 设置网络制式和网元版本AW_ModuleOperate.aw_setNetworkTypeAndNeversionType(peculiarityLocator, commonParam);// 设置看网目的if (!commonParam.getNevPurposeValue().isEmpty()) {AW_ModuleOperate.aw_setNetPrupose(peculiarityLocator, commonParam);}}public static boolean uploaddataAutoSummit(String datapath){AW_SeleniumMethod.aw_sleep(20);String windowHandle = driver.getWindowHandle();WebDriver newwindow = AW_SeleniumMethod.aw_switchtoNewWindow(Var_NetworkOptimize.UploadDataTitle);newwindow.manage().window().maximize();//设置任务自动提交AW_FileUpload.aw_AutoSummitBtn();//上传数据AW_FileUpload.aw_uploadTestDataToDataCenter(datapath);//boolean  bRet = AW_NetWorkOptimize.isUploaddataWindowPresent(newwindow);boolean  bRet = AW_SeleniumMethod.aw_isWindowPresentBytitle(Var_NetworkOptimize.UploadDataTitle);int delay = 0;//判断数据上传窗口是否消失while(true){//判断数据上传窗口bRet = AW_SeleniumMethod.aw_isWindowPresentBytitle(Var_NetworkOptimize.UploadDataTitle);AW_SeleniumMethod.aw_sleep(10);delay++;if(!bRet || delay>30*60/10){break;}}AW_SeleniumMethod.aw_keyPressNative(KeyEvent.VK_ENTER);//切换到主窗口AW_SeleniumMethod.aw_swithtoWindow(windowHandle);return bRet;}/** * 操作下一步按钮,进入MR任务创建界面 * @param operateType 业务类型 * @author Rkf74816 */public static void ReportPreviousBtnClick(){AW_SeleniumMethod.aw_LeftSingleClickByID(MRNevaluationLoc.mrPreviousBtnId);}/** * 给定任务进行数据上传后自动提交,成功后返回false *  * @author 赵锐平 */public static void EnterReprotDwnloadInterfaceByTaskId(String taskId,PeculiarityLocator peculiarityLocator ){int nIndextr = 2;int nPos =  AW_TaskManageOperate.aw_getIndexByTaskId(peculiarityLocator, taskId);nIndextr+=nPos;String taskxpath = "//div[@id='mrTaskManageGridId-body']/div/table/tbody/tr["+ nIndextr+ "]/"+"td[2]/div/span";System.out.println(taskxpath);AW_SeleniumMethod.aw_LeftSingleClickByXpath(taskxpath);}//只有一个工程包时,只勾选第一个检查项public static void aw_selectFirstCheckItemOnPrjPackage(){//展开工程包下面的检查项AW_SeleniumMethod.aw_LeftSingleClickByXpath(MRNevaluationLoc.openOutPrjPackage);//却掉所有检查项的勾选AW_SeleniumMethod.aw_LeftSingleClickByXpath(MRNevaluationLoc.selectPrjPackageContent);//勾选第一个检查项AW_SeleniumMethod.aw_LeftSingleClickByXpath(MRNevaluationLoc.firstCheckItemPrjPackage);}/** * 获取任务列表显示的所有任务 * @author zKF54587 */public static void aw_EnterSpecificTab(PeculiarityLocator peculiarityLocator,String tabText) {// 进入任务管理页面 AW_CommonOperate.aw_enterFunctionPage(peculiarityLocator, tabText);// 检查任务是否新建成功// 刷新任务列表AW_SeleniumMethod.aw_LeftSingleClickByXpath(MRNevaluationLoc.refreshTaskInfoOnReportCollectXpath);}public static void aw_EnterSpecificTab2(PeculiarityLocator peculiarityLocator,String tabText) {// 进入任务管理页面 //AW_CommonOperate.aw_enterFunctionPage(peculiarityLocator, tabText);// 检查任务是否新建成功// 刷新任务列表AW_SeleniumMethod.aw_LeftSingleClickByXpath(MRNevaluationLoc.refreshTaskInfoOnReportCollectXpath);}/** * 给定任务进行数据上传后自动提交,成功后返回false *  * @author 赵锐平 */public static void ReprotDwnloadbyTaskId(String DwnBtnId,String datapath,String taskId,PeculiarityLocator peculiarityLocator ){int nIndextr = 2;int nPos =  AW_TaskManageOperate.aw_getIndexByTaskId(peculiarityLocator, taskId);nIndextr+=nPos;String taskxpath = "//div[@id='mrTaskManageGridId-body']/div/table/tbody/tr["+ nIndextr+ "]/"+"td[2]/div/span";System.out.println(taskxpath);AW_SeleniumMethod.aw_LeftSingleClickByXpath(taskxpath);AW_SeleniumMethod.aw_LeftSingleClickByXpath(MRNevaluationLoc.FisrtReprotClickXpath);AW_SeleniumMethod.aw_sleep(10);AW_FileHandle.file_downloadById(MRNevaluationLoc.btnMrReportDown,datapath);}/** * 操作下一步按钮,退出SOP任务创建界面 * @param operateType 业务类型 * @author zKF54587 * @time 2013/7/12 */public static void quitSOPinterface(){AW_SeleniumMethod.aw_LeftSingleClickByXpath(MRNevaluationLoc.windowColose);Assert.assertTrue(AW_SeleniumMethod.aw_IsTestPresent("请确认是否关闭 \"CHRMR看网\" 窗体?"));AW_SeleniumMethod.aw_keyPressNative(KeyEvent.VK_ENTER);}/** * 根据指定的门限名称,查看门限在表中的位置 * @author j00129746 */public static int aw_getIndexByThreadItemName(String ItemName){int taskIndex = -1;String taskInfo = AW_SeleniumMethod.aw_getTextbyID(MRNevaluationLoc.cdrSetThresholdGridId);System.out.println("#############@#:"+taskInfo);String[] taskInfoList = taskInfo.split("\n");for(int i=0; i < taskInfoList.length; i+=5){System.out.println("oneitme:" +taskInfoList[i]);if(taskInfoList[i].equals(ItemName)){taskIndex = i/5;taskIndex+=1;break;}}return taskIndex;}/** * 根据指定的门限名称,查看门限在表中的位置 * @author j00129746 */public static int aw_getIndexByThreadItemNameUMTS(String ItemName){int taskIndex = -1;String taskInfo = AW_SeleniumMethod.aw_getTextbyID(MRNevaluationLoc.mrSetThresholdGridId);System.out.println("#############@#:"+taskInfo);String[] taskInfoList = taskInfo.split("\n");for(int i=0; i < taskInfoList.length; i+=5){System.out.println("oneitme:" +taskInfoList[i]);if(taskInfoList[i].equals(ItemName)){taskIndex = i/5;taskIndex+=1;break;}}return taskIndex;}public static void SetThreadValue(String itemName,String itemvalue)

0 0
原创粉丝点击