private void DeleteCloudProject() // Delete Cloud Project { PrintTitle("DeleteCloudProject"); api.LinkWebUI(txtCloudIp.Text + "/broadWeb/bwconfig.asp?username=admin"); api.ById("userField").Enter("").Submit().Exe(); PrintStep(); string sProjectName = "WISE%2DDQA"; // WISE-DQA api.ByXpath("//a[contains(@href, '/broadWeb/project/deleteProject.asp?') and contains(@href, 'ProjName=" + sProjectName + "')]").Click(); // Confirm to delete porject sProjectName = "WISE-DQA"; // WISE-DQA string alertText = api.GetAlartTxt(); if (alertText == "Delete this project (" + sProjectName + "), are you sure?") { api.Accept(); } }
private void DeleteCloudTag() // C2G { PrintTitle("DeleteCloudTag"); api.LinkWebUI(txtCloudIp.Text + "/broadWeb/bwconfig.asp?username=admin"); api.ById("userField").Enter("").Submit().Exe(); PrintStep(); // Configure project by project name string sProjectName = "WISE%2DDQA"; // WISE-DQA api.ByXpath("//a[contains(@href, '/broadWeb/bwMain.asp?pos=project') and contains(@href, 'ProjName=" + sProjectName + "')]").Click(); PrintStep(); api.SwitchToCurWindow(0); api.SwitchToFrame("leftFrame", 0); // 刪除第一個Tag api.ByXpath("//td[2]/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/a/font").Click(); System.Threading.Thread.Sleep(2000); api.SwitchToCurWindow(0); api.SwitchToFrame("rightFrame", 0); api.ByXpath("//a[contains(@href, '/broadWeb/tag/deleteTag.asp') and contains(@href, 'action=delete_tag')]").Click(); // delete string alertText = api.GetAlartTxt(); if (alertText == "Delete this tag, are you sure?") { api.Accept(); } api.SwitchToCurWindow(0); api.SwitchToFrame("leftFrame", 0); api.ByXpath("//a[contains(@href, '/broadWeb/bwMainRight.asp') and contains(@href, 'name=" + GetNodeName() + "')]").Click(); StartDownload(api); }
private void GroundPC_DeleteTag() { // Delete AT_AI0004/AT_AO0004/AT_DI0004/AT_DO0004/OPCDA_0004/OPCUA_0004/Acc_0004/ConAna_0004/SystemSec_0004 EventLog.AddLog("<GroundPC> Delete AT_AI0004/AT_AO0004/AT_DI0004/AT_DO0004 tags"); api.SwitchToCurWindow(0); api.SwitchToFrame("leftFrame", 0); api.ByXpath("//a[3]/img").Click(); //ModSim api.SwitchToCurWindow(0); api.SwitchToFrame("rightFrame", 0); api.ByXpath("(//input[@name='tsel'])[4]").Click(); //AT_AI0004 api.ByXpath("(//input[@name='tsel'])[254]").Click(); //AT_AO0004 api.ByXpath("(//input[@name='tsel'])[504]").Click(); //AT_DI0004 api.ByXpath("(//input[@name='tsel'])[754]").Click(); //AT_DO0004 api.ByCss("span.e5").Click(); // delete string alertText = api.GetAlartTxt(); if (alertText == "Are you sure you want to delete these tags?" || alertText == "Are you sure you want to delete these 4 tags?") { api.Accept(); } PrintStep(api, "<GroundPC> Delete AT_AI0004/AT_AO0004/AT_DI0004/AT_DO0004 tags"); EventLog.AddLog("<GroundPC> Delete OPCDA_0004 tag"); api.SwitchToCurWindow(0); api.SwitchToFrame("leftFrame", 0); api.ByXpath("//tr[2]/td/table/tbody/tr/td/a[3]/img").Click(); //OPCDA api.SwitchToCurWindow(0); api.SwitchToFrame("rightFrame", 0); api.ByXpath("(//input[@name='tsel'])[4]").Click(); //OPCDA_0004 api.ByCss("span.e5").Click(); // delete string alertText2 = api.GetAlartTxt(); if (alertText2 == "Are you sure you want to delete these tags?" || alertText2 == "Are you sure you want to delete these 1 tags?") { api.Accept(); } PrintStep(api, "<GroundPC> Delete OPCDA_0004 tag"); EventLog.AddLog("<GroundPC> Delete OPCUA_0004 tag"); api.SwitchToCurWindow(0); api.SwitchToFrame("leftFrame", 0); api.ByXpath("//tr[3]/td/table/tbody/tr/td/a[3]/img").Click(); //OPCUA api.SwitchToCurWindow(0); api.SwitchToFrame("rightFrame", 0); api.ByXpath("(//input[@name='tsel'])[4]").Click(); //OPCUA_0004 api.ByCss("span.e5").Click(); // delete string alertText3 = api.GetAlartTxt(); if (alertText3 == "Are you sure you want to delete these tags?" || alertText3 == "Are you sure you want to delete these 1 tags?") { api.Accept(); } PrintStep(api, "<GroundPC> Delete OPCUA_0004 tag"); EventLog.AddLog("<GroundPC> Delete Acc_0004 tag"); api.SwitchToCurWindow(0); api.SwitchToFrame("leftFrame", 0); api.ByXpath("//a[contains(@href, '/broadWeb/bwMainRight.asp?pos=AccList')]").Click(); //Acc Point api.SwitchToCurWindow(0); api.SwitchToFrame("rightFrame", 0); api.ByXpath("(//input[@name='tsel'])[4]").Click(); //Acc_0004 //api.ByXpath("(//a[contains(text(),'Delete')])[4]").Click(); // delete api.ByXpath("//a[2]/font/b").Click(); string alertText4 = api.GetAlartTxt(); //if (alertText4 == "Delete this Accumulation Point(TagName=Acc_0004), are you sure? ") if (alertText4 == "Are you sure you want to delete these 1 tags?") { api.Accept(); } PrintStep(api, "<GroundPC> Delete Acc_0004 tag"); EventLog.AddLog("<GroundPC> Delete ConAna_0004 tag"); api.SwitchToCurWindow(0); api.SwitchToFrame("leftFrame", 0); api.ByXpath("//a[contains(@href, '/broadWeb/bwMainRight.asp?pos=ConstList')]").Click(); //Const Point api.SwitchToCurWindow(0); api.SwitchToFrame("rightFrame", 0); api.ByXpath("(//input[@name='tsel'])[4]").Click(); //ConAna_0004 //api.ByXpath("(//a[contains(text(),'Delete')])[4]").Click(); // delete api.ByXpath("//a[2]/font/b").Click(); string alertText5 = api.GetAlartTxt(); //if (alertText5 == "Delete this Constant Point(TagName=ConAna_0004), are you sure? ") if (alertText5 == "Are you sure you want to delete these 1 tags?") { api.Accept(); } PrintStep(api, "<GroundPC> Delete ConAna_0004 tag"); EventLog.AddLog("<GroundPC> Delete SystemSec_0004 tag"); api.SwitchToCurWindow(0); api.SwitchToFrame("leftFrame", 0); api.ByXpath("//a[contains(@href, '/broadWeb/bwMainRight.asp?pos=SysList')]").Click(); //System Point api.SwitchToCurWindow(0); api.SwitchToFrame("rightFrame", 0); api.ByXpath("(//input[@name='tsel'])[4]").Click(); //SystemSec_0004 //api.ByXpath("(//a[contains(text(),'Delete')])[4]").Click(); // delete api.ByXpath("//a[2]/font/b").Click(); string alertText6 = api.GetAlartTxt(); //if (alertText6 == "Delete this System Point(TagName=SystemSec_0004), are you sure? ") if (alertText6 == "Are you sure you want to delete these 1 tags?") { api.Accept(); } PrintStep(api, "<GroundPC> Delete SystemSec_0004 tag"); }
private void GroundPC_DeleteProject(string sBrowser, string sProjectName, string sWebAccessIP, string sTestLogFolder) { if (sBrowser == "Internet Explorer") { EventLog.AddLog("<GroundPC> Browser= Internet Explorer"); api = new AdvSeleniumAPI("IE", ""); System.Threading.Thread.Sleep(1000); } else if (sBrowser == "Mozilla FireFox") { EventLog.AddLog("<GroundPC> Browser= Mozilla FireFox"); api = new AdvSeleniumAPI("FireFox", ""); System.Threading.Thread.Sleep(1000); } api.LinkWebUI(baseUrl + "/broadWeb/bwconfig.asp?username=admin"); api.ById("userField").Enter("").Submit().Exe(); PrintStep(api, "<GroundPC> Login WebAccess"); EventLog.AddLog("<GroundPC> Delete " + sProjectName + " project."); api.ByXpath("//a[contains(@href, '/broadWeb/project/deleteProject.asp?') and contains(@href, 'ProjName=" + sProjectName + "')]").Click(); // Confirm to delete project string alertText = api.GetAlartTxt(); //if (alertText == "Delete this project (" + sProjectName + "), are you sure?") // api.Accept(); switch (slanguage) { case "ENG": if (alertText == "Delete this project (" + sProjectName + "), are you sure?") { api.Accept(); } break; case "CHT": if (alertText == "您確定要刪除這個工程(" + sProjectName + ")?") { api.Accept(); } break; case "CHS": if (alertText == "您肯定要删除工程(" + sProjectName + ")吗?") { api.Accept(); } break; case "JPN": if (alertText == "このプロジェクト (" + sProjectName + ") を削除してもよろしいですか?") { api.Accept(); } break; case "KRN": if (alertText == "이 프로젝트(" + sProjectName + ")를 삭제합니다. 계속하시겠습니까?") { api.Accept(); } break; case "FRN": if (alertText == "Supprimer ce projet (" + sProjectName + "), êtes-vous sûr ?") { api.Accept(); } break; default: if (alertText == "Delete this project (" + sProjectName + "), are you sure?") { api.Accept(); } break; } PrintStep(api, "<GroundPC> Delete " + sProjectName + "Node"); Thread.Sleep(10000); api.Quit(); PrintStep(api, "<CloudPC> Quit browser"); }
private void CreateProject(string sProjectName, string sWebAccessIP) { EventLog.AddLog("Create a new project"); // Create a new project //driver.FindElement(By.Name("ProjName")).Clear(); //driver.FindElement(By.Name("ProjName")).SendKeys(projName); //driver.FindElement(By.Name("ProjIPLong")).Clear(); //driver.FindElement(By.Name("ProjIPLong")).SendKeys(sWebAccessIP); //driver.FindElement(By.Name("ProjIPLong")).Submit(); api.ByName("ProjName").Clear(); int i = api.ByName("ProjName").Enter(sProjectName).Exe(); //PrintStep("123123"); api.ByName("ProjIPLong").Clear(); api.ByName("ProjIPLong").Enter(sWebAccessIP).Submit().Exe(); //api.ByName("ProjIPLong").Submit().Exe(); // Confirm to create //string alertText = driver.SwitchTo().Alert().Text; string alertText = api.GetAlartTxt(); switch (slanguage) { case "ENG": if (alertText == "Do you want to create a new project ( Project Name : " + sProjectName + " )? ") { api.Accept(); } break; case "CHT": if (alertText == "您要建立新的工程 ( 工程名稱 : " + sProjectName + " )? ") { api.Accept(); } break; case "CHS": if (alertText == "你想建立新的工程 ( 工程名称 : " + sProjectName + " )? ") { api.Accept(); } break; case "JPN": if (alertText == "新しいプロジェクトを作成しますか ( プロジェクト名 : " + sProjectName + " )? ") { api.Accept(); } break; case "KRN": if (alertText == "새 프로젝트를 생성할까요? ( 프로젝트명 : " + sProjectName + " )? ") { api.Accept(); } break; case "FRN": if (alertText == "Voulez-vous créer un nouveau projet ( Nom projet : " + sProjectName + " )? ") { api.Accept(); } break; default: if (alertText == "Do you want to create a new project ( Project Name : " + sProjectName + " )? ") { api.Accept(); } break; } }