private void btnCheckBlackList_Click(object sender, EventArgs e) { Random rand = new Random(); String hWnd = au3.WinGetHandle("[TITLE:VIP72 Socks Client]"); String hwndSTR = "[HANDLE:" + hWnd.ToString() + "]"; au3.WinSetOnTop(hwndSTR, "", 1); int x = au3.WinGetPosX(hwndSTR, "") + 8; int y = au3.WinGetPosY(hwndSTR, "") + 30; x += au3.ControlGetPosX(hwndSTR, "", "[ID:116]"); y += au3.ControlGetPosY(hwndSTR, "", "[ID:116]"); int maxRand = rand.Next(14); au3.MouseClick("LEFT", x + 11, y + 30); au3.MouseClick("RIGHT", x + 11, y + 30 + maxRand * 17); //au3.MouseClick("RIGHT", x + 11, y + 30 + maxRand * 20); //au3.ControlClick(hwndSTR, "", "[ID:116]", "left", 1, 57, 35); //au3.ControlClick(hwndSTR, "", "[ID:116]", "right", 1, 11, 30 + maxRand * 18); au3.Send("{DOWN}"); au3.Send("{DOWN}"); au3.Send("{DOWN}"); au3.Send("{DOWN}"); au3.Send("{ENTER}"); Boolean checkNotBlackist = waitText(au3, "[ACTIVE]", "[ID:33]", "is NOT black", "is BLACKLISTED", 30); au3.ControlClick("[ACTIVE]", "", "[ID:99]"); if (checkNotBlackist) { au3.MouseClick("LEFT", x + 11, y + 30 + maxRand * 17, 2); } // MessageBox.Show("Login Success: " + checkNotBlackist); au3.WinSetOnTop(hwndSTR, "", 0); }
public void UploadFile(string path) { AutoItX3 autoIT = new AutoItX3(); autoIT.ControlClick("Open", "", "Edit1"); System.Threading.Thread.Sleep(1000); autoIT.Send(path); autoIT.ControlClick("Open", "", "Button1"); }
// Блок private void timer2_Tick(object sender, EventArgs e) { AutoItX3 autoIt = new AutoItX3(); if (autoIt.WinExists("ОШИБКА") == 1) { string t = autoIt.ControlGetText("ОШИБКА", "", "TStaticText1"); string pos = "ПЕРЕПОЛНЕНИЕ"; if (t.Contains(pos)) { autoIt.WinActivate("ОШИБКА"); autoIt.WinGetState("ОШИБКА"); autoIt.ControlClick("ОШИБКА", "", "[CLASS:TBitBtn; INSTANCE:1]", "main", 1); autoIt.Sleep(5000); autoIt.WinClose(textBox2.Text); autoIt.Sleep(4000); autoIt.WinActivate("ЗАВЕРШЕНИЕ РАБОТЫ"); autoIt.WinGetState("ЗАВЕРШЕНИЕ РАБОТЫ"); autoIt.Sleep(2000); autoIt.ControlClick("ЗАВЕРШЕНИЕ РАБОТЫ", "", "[CLASS:Button; INSTANCE:1]", "main", 1); autoIt.Sleep(Convert.ToInt16(textBox5.Text)); autoIt.Run(textBox1.Text); autoIt.Sleep(7000); autoIt.WinActivate("ВЫБОР БИБЛИОТЕК"); autoIt.WinGetState("ВЫБОР БИБЛИОТЕК"); autoIt.Sleep(3000); //Выбор библиотеки поцвету пикселя начало object coord = autoIt.PixelSearch(0, 0, Screen.GetWorkingArea(this).Width, Screen.GetWorkingArea(this).Height, Convert.ToInt32(Convert.ToString(textBox3.Text), 16));//edit texbox3 hex object[] pixelcoord = (object[])coord; autoIt.MouseClick("Left", (int)pixelcoord[0], (int)pixelcoord[1], 1, 10); //Выбор библиотеки поцвету пикселя конец autoIt.Sleep(Convert.ToInt16(textBox6.Text)); //Запуск PostWin поцвету пикселя начало autoIt.WinActivate(textBox2.Text); autoIt.WinGetState(textBox2.Text); autoIt.Sleep(2000); object coord1 = autoIt.PixelSearch(0, 0, Screen.GetWorkingArea(this).Width, Screen.GetWorkingArea(this).Height, Convert.ToInt32(Convert.ToString(textBox4.Text), 16));//edit textbox4 hex object[] pixelcoord1 = (object[])coord1; autoIt.MouseClick("Left", (int)pixelcoord1[0], (int)pixelcoord1[1], 1, 10); //Запуск PostWin поцвету пикселя конец autoIt.Sleep(2000); //*** Запись лога string date = DateTime.Now.ToString("dd MMMM yyyy,HH:mm:ss"); System.IO.StreamWriter writer = new System.IO.StreamWriter("slib.dll", true); writer.WriteLine(date); writer.Close(); //*** Запись лога конец } else { timer2.Interval = 1; // Выбираем из массива случайное значение для таймера } } }
public Boolean UploadFiles() { IList <IWebElement> subList = rdriver.FindElements(By.XPath("//ul[@class='mc-tertiary-list secondary-action-menu']//li")); int length = subList.Count; for (int i = 0; i <= length; i++) { string actionMenu = rdriver.FindElement(By.XPath("//div[@id='pagelet-2']//li[1]")).Text; if (actionMenu == "Upload files") { rdriver.FindElement(By.XPath("//div[@id='pagelet-2']//li[1]")).Click(); break; } } //Selecting the file from the desktop path Thread.Sleep(5000); auto.WinActivate("Open"); auto.ControlFocus("Open", "", "Edit1"); string path = ConfigurationManager.AppSettings["Path"]; auto.ControlSetText("Open", "", "Edit1", path); auto.ControlClick("Open", "", "Button1"); Thread.Sleep(2000); auto.ControlFocus("Open", "", "DirectUIHWND2"); SendKeys.SendWait("^(a)"); Thread.Sleep(2000); string[] fileList = Directory.GetFiles(path); List <string> fileNameList = new List <string>(); for (int i = 0; i < fileList.Length; i++) { fileNameList.Add(Path.GetFileName(fileList[i])); } string[] fileNameArray = fileNameList.ToArray(); auto.ControlClick("Open", "", "Button1"); Thread.Sleep(20000); IList <IWebElement> totalFiles = rdriver.FindElements(By.XPath("//tbody[@class='mc-table-body mc-table-body-culled']//tr")); int filesCount = totalFiles.Count; // Console.WriteLine(filesCount); for (int j = 1; j <= filesCount; j++) { string fileName = rdriver.FindElement(By.XPath("//tr[" + (j) + "]//td[2]")).Text; Console.WriteLine(fileName); if (!fileNameArray.Contains(fileName)) { return(false); } } return(true); }
public void ClickNewJobButton(string windowNewOrderEntry, string windowOrderLog) { _Au3Lib.WinActivate(windowNewOrderEntry); _Au3Lib.WinWaitActive(windowNewOrderEntry); _Au3Lib.ControlClick(windowNewOrderEntry, "", "[NAME:btnNewJob]"); _Au3Lib.WinWaitActive(windowOrderLog); _Au3Lib.Sleep(250); }
private void btnStart_Click(object sender, EventArgs e) { //GeckoPreferences.User["network.proxy.type"] = 1; //GeckoPreferences.User["network.proxy.socks"] = "127.0.0.1"; //GeckoPreferences.User["network.proxy.socks_port"] = 9951; //GeckoPreferences.User["network.proxy.socks_version"] = 5; // GeckoPreferences.User["network.proxy.socks_remote_dns"] = true; // GeckoPreferences.User["media.peerconnection.enabled"] = false; //GeckoPreferences.User["network.http.max-connections"] = 32; //GeckoPreferences.User["network.http.max-persistent-connections-per-proxy"] = 16; AutoItX3 au3 = new AutoItX3(); int hwnd1 = au3.Run(@"C:\Users\longthanh\Downloads\Compressed\vip72socks\vip72socks.exe"); au3.WinWaitActive("[TITLE:VIP72 Socks Client]", "", 10); String hWnd = au3.WinGetHandle("[TITLE:VIP72 Socks Client]"); String hwndSTR = "[HANDLE:" + hWnd.ToString() + "]"; // int hWnd = au3.WinWait("[TITLE:VIP72 Socks Client]", "", 10); int tmp = au3.ControlClick(hwndSTR, "", "[ID:119]"); waitText(au3, hwndSTR, "[ID:131]", "System ready", "ERROR", 30); //click select country au3.ControlClick(hwndSTR, "", "[ID:7811]"); waitText(au3, hwndSTR, "[ID:131]", "Total proxies online", "ERROR", 30); //click Country au3.ControlClick(hwndSTR, "", "[ID:7809]", "left", 2, 11, 58); //click select Region au3.ControlClick(hwndSTR, "", "[ID:7813]"); System.Threading.Thread.Sleep(2000); //click Region au3.ControlClick(hwndSTR, "", "[ID:7809]", "left", 2, 11, 50); //click search au3.ControlClick(hwndSTR, "", "[ID:127]"); waitText(au3, hwndSTR, "[ID:131]", new String[] { "Only", "Ok" }, "ERROR", 30); au3.ControlClick(hwndSTR, "", "[ID:116]", "right", 1, 57, 35); au3.ControlSend(hwndSTR, "", "[ID:116]", "{DOWN}"); au3.ControlSend(hwndSTR, "", "[ID:116]", "{ENTER}"); System.Threading.Thread.Sleep(10); String s = Clipboard.GetText(); au3.ControlClick(hwndSTR, "", "[ID:116]", "right", 1, 57, 35); System.Threading.Thread.Sleep(1); au3.ControlSend(hwndSTR, "", "[ID:116]", "{DOWN}"); au3.ControlSend(hwndSTR, "", "[ID:116]", "{DOWN}"); au3.ControlSend(hwndSTR, "", "[ID:116]", "{DOWN}"); au3.ControlSend(hwndSTR, "", "[ID:116]", "{DOWN}"); au3.ControlSend(hwndSTR, "", "[ID:116]", "{ENTER}"); Boolean checkNotBlackist = waitText(au3, "[ACTIVE]", "[ID:33]", "is NOT black", "is BLACKLISTED", 30); au3.ControlClick("[ACTIVE]", "", "[ID:99]"); MessageBox.Show("Login Success: " + s + " " + checkNotBlackist); // webBrowser1.Navigate("youtube.com"); }
public void Stop() { aux.ControlClick(WINTITLE, "", "WindowsForms10.BUTTON.app.0.2c908d510");//параметры -окно кнопка и идентификатор кнопки aux.WinWait(WINTITLE); aux.WinActivate(WINTITLE); aux.WinWaitActive(WINTITLE); }
public void OpenImageFromLocalFileSystem() { //Navigates the browser to given URL driver.Navigate().GoToUrl("https://images.google.com/"); string fullFilePath = @"C:\AutomationImages\Actual.jpg"; Console.WriteLine("Open File: " + fullFilePath); IWebElement searchByImageButton = driver.FindElement(By.XPath("//span[@id='qbi']")); searchByImageButton.Click(); IWebElement searchByImageWindow = driver.FindElement(By.XPath("//div[@id='qbp']")); IWebElement tabUploadImage = searchByImageWindow.FindElement(By.XPath("//div[@Class='qbtbha sl']")); tabUploadImage.Click(); IWebElement btnChoosefile = searchByImageWindow.FindElement(By.XPath("//input[@id='qbfile']")); btnChoosefile.Click(); System.Threading.Thread.Sleep(2000); AutoItX3 autoIT = new AutoItX3(); autoIT.WinWait("Open"); autoIT.WinActivate("Open"); autoIT.ControlFocus("Open", "", "[CLASS:Edit]"); autoIT.ControlSetText("Open", "", "[CLASS:Edit]", fullFilePath); //autoIT.Send(@"Actual.jpg"); autoIT.ControlClick("Open", "", "[CLASS:Button; Text: Open]"); }
// Остановка приложения с помощью команды ControlClick() public void Stop() { // 1 параметр: Название окна, в котором находится кнопка, // 2 параметр: Уточняющий параметр - текст кнопки (необязательный), // 3 параметр: Идентификатор кнопки - локатор. aux.ControlClick(WINTITLE, "", "WindowsForms10.BUTTON.app.0.2c908d510"); }
public void Stop() { //название окна //необяз - название кнопки //локатор кнопки aux.ControlClick(WINTITLE, "", "WindowsForms10.BUTTON.app.0.2c908d510"); }
public static void UploadFile(string FilePath) { AutoItX3 AutoIT = new AutoItX3(); AutoIT.WinWaitActive("Open", "", 1500); AutoIT.ControlFocus("Open", "", "Edit1"); AutoIT.ControlSetText("Open", "", "Edit1", FilePath); AutoIT.ControlClick("Open", "", "Button1"); }
private void clearProxy_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(3000); AutoItX3 au3 = new AutoItX3(); String hWnd = au3.WinGetHandle("[TITLE:VIP72 Socks Client]"); au3.MouseMove(0, 0); String hwndSTR = "[HANDLE:" + hWnd.ToString() + "]"; au3.WinSetOnTop(hwndSTR, "", 1); au3.ControlClick(hwndSTR, "", "[ID:7303]"); au3.ControlClick(hwndSTR, "", "[ID:117]", "menu", 1, 57, 35); //System.Threading.Thread.Sleep(2000); au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{DOWN}"); System.Threading.Thread.Sleep(2000); //au3.ControlSend(hwndSTR, "", "[ID:117]", "{ENTER}"); System.Threading.Thread.Sleep(2000); }
private void buttonAppServer_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("CMD.exe", "/C mstsc"); AutoItX3 a = new AutoItX3(); a.WinWaitActive("Remote Desktop Connection"); a.ControlSend("Remote Desktop Connection", "", "[CLASS:Edit; INSTANCE:1]", "{LSHIFT}" + appserver.Text.ToString() + ".usmlvv1d0a.smshsc.net"); a.ControlClick("Remote Desktop Connection", "", "[CLASS:Button; INSTANCE:5]"); } catch (Exception e3) { buttonAppServer.Text = "Try Again"; } }
public static void AddAutoReplyVoice(string video) { PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.tabvoice); PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.autoreply_content); Thread.Sleep(2 * 1000); AutoItX3 au3 = new AutoItX3(); PortalChromeDriver.Wait(TimeSpan.FromSeconds(10)); au3.ControlFocus("Open", "", "Edit1"); au3.ControlSetText("Open", "", "Edit1", @"D:\Test case\Test case\测试素材\Test AMR\" + video); PortalChromeDriver.Wait(TimeSpan.FromSeconds(2)); au3.ControlClick("Open", "", "Button1"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(5)); PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.Bottom_Save); }
public static void AddAutoReplyImage(string image) { PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.tabimage); PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.autoreply_content); AutoItX3 au3 = new AutoItX3(); PortalChromeDriver.Wait(TimeSpan.FromSeconds(10)); au3.ControlFocus("Open", "", "Edit1"); au3.ControlSetText("Open", "", "Edit1", @"C:\Users\v-haxun\Desktop\Image\" + image); PortalChromeDriver.Wait(TimeSpan.FromSeconds(2)); au3.ControlClick("Open", "", "Button1"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(5)); PortalChromeDriver.ClickElementPerXpath(FollowedAutoReplyElement.Bottom_Save); //Thread.Sleep(2 * 1000); }
public static void SendImage() { try { PortalChromeDriver.GetElementByXpath(HIPortalPageUIElement.addimg_hidden_input).Click(); AutoItX3 au3 = new AutoItX3(); PortalChromeDriver.Wait(TimeSpan.FromSeconds(10)); au3.ControlFocus("Open", "", "Edit1"); au3.ControlSetText("Open", "", "Edit1", @"C:\Users\v-haxun\Desktop\Test.png"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(2)); au3.ControlClick("Open", "", "Button1"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(5)); } catch (Exception e) { } }
public void TC_WorkSamplesUpload() { GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "ShareSkill"); test = extent.StartTest("Uploading File Test"); // create an object for serviceLIsting page ServiceListing skillObj = new ServiceListing(); //click on the share skill button skillObj.ShareSkillBtnClick(); //enter all the details from the excel Thread.Sleep(2000); string title = GlobalDefinitions.ExcelLib.ReadData(3, "Title"); string desc = GlobalDefinitions.ExcelLib.ReadData(3, "Description"); skillObj.inputTitleDescription(title, desc); //work samples file upload skillObj.WorkSamplesUploadClick(); //AutoIt - Handles windows that do not belong to browser AutoItX3 autoIt = new AutoItX3(); autoIt.WinActivate("Open"); //Activate - so that the next set of actions happen on this window Thread.Sleep(2000); autoIt.Send(@"C:\Users\sudha\Desktop\FileUploadTest.docx"); Thread.Sleep(2000); // autoIt.Send("{ENTER}"); // autoIt.MouseClick("Button1",0,0, 1, 0); autoIt.ControlClick("Open", "", "Button1"); //Check whether document uploaded property or not if (skillObj.IsWorkSamplesDocUpload()) { Base.test.Log(LogStatus.Pass, "Document uploaded successfully using AutoIt"); Assert.True(true); } else { test.Log(LogStatus.Fail, "Document not uploaded"); Assert.Fail(); } }
private void Configure(string appTitle, string Text, string cntrlWinAuth, string cntrlSQLAuth, string cntrlUser, string textUser, string cntrlPass, string textPass, string cntrlLicense, string textlicense, string cntrlBackup, string textBackup, string btnControl) { _robot.WinActivate(appTitle); // _robot.ControlFocus(appTitle, Text, cntrlSQLAuth); _robot.ControlSetText(appTitle, Text, cntrlUser, textUser); _robot.ControlSetText(appTitle, Text, cntrlPass, textPass); _robot.ControlSetText(appTitle, Text, cntrlLicense, textlicense); _robot.ControlSetText(appTitle, Text, cntrlBackup, textBackup); _robot.ControlFocus(appTitle, Text, btnControl); _robot.ControlClick(appTitle, Text, btnControl, "LEFT", 1); }
static void UploadLanesTemplate() { try { WebDriverWait wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(10)); IWebElement element = wait.ValidateControl("uploadBtn"); element.Click(); Thread.Sleep(1000); AutoItX3 autoIt = new AutoItX3(); autoIt.ControlFocus("Open", "", "Edit1"); Thread.Sleep(1000); autoIt.ControlSetText("Open", "", "Edit1", requestTemplatePath + fileName); Thread.Sleep(1000); autoIt.ControlClick("Open", "", "Button1"); } catch (Exception ex) { throw ex; } }
public static void AddMenu_Image() { try { PortalChromeDriver.ClickElementPerXpath(MenuElement.Send_Message); PortalChromeDriver.ClickElementPerXpath(MenuElement.tabImage); PortalChromeDriver.ClickElementPerXpath(MenuElement.ImageChoose); AutoItX3 au3 = new AutoItX3(); PortalChromeDriver.Wait(TimeSpan.FromSeconds(10)); au3.ControlFocus("Open", "", "Edit1"); au3.ControlSetText("Open", "", "Edit1", @"C:\Users\v-haxun\Desktop\Image\efwe.jpg"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(2)); au3.ControlClick("Open", "", "Button1"); PortalChromeDriver.Wait(TimeSpan.FromSeconds(5)); } catch (Exception e) { throw new Exception(e.Message); } }
/// <summary> /// Upload image on server /// </summary> /// <param name="imagePath">Path to the file</param> /// <param name="millisecondsUploadTimeout">Amount of time will wait for upload file before failing a request</param> public void UploadImageFile(string imagePath, int millisecondsUploadTimeout) { btnChooseFiles.WaitUntilVisible(2000); int oldCountUploadedFiles = divUploadedFiles.FindElements(By.ClassName("file-name")).Count; btnChooseFiles.Click(); AutoItX3 autoIt = new AutoItX3(); if (autoIt.WinWait(TitleOpenFileDialog) == 0) { throw new NullReferenceException("OpenFileDialog can not be found."); } autoIt.ControlFocus(TitleOpenFileDialog, "", "Edit1"); autoIt.Sleep(500); autoIt.ControlSetText(TitleOpenFileDialog, "", "Edit1", imagePath); autoIt.ControlClick(TitleOpenFileDialog, "", "Button1"); int newCountUploadedFiles = 0; for (int i = 0; (i < millisecondsUploadTimeout) && (newCountUploadedFiles <= oldCountUploadedFiles); i += 500) { System.Threading.Thread.Sleep(500); newCountUploadedFiles = divUploadedFiles.FindElements(By.ClassName("file-name")).Count; } string info = "Upload: " + DateTime.Now.ToString() + " - " + Path.GetFileName(imagePath) + "\n"; if (oldCountUploadedFiles == newCountUploadedFiles) { throw new ErrorUploadImagesException("Error loading: " + info); } txtAdditionalRemarks.SendKeys(info); btnSave.Click(); }
public void Stop() { aux.Sleep(1000); aux.ControlClick(WINTITLE, "&Exit", "WindowsForms10.BUTTON.app.0.2c908d510"); // aux.ControlClick(WINTITLE, "&Exit", ""); }
public void Stop() { autx.ControlClick(winTitle, "", "WindowsForms10.BUTTON.app.0.2c908d510"); }
public void DoUpload(string Filepath) { driver.Navigate().GoToUrl(baseURL + "/v/upload"); try { Thread.Sleep(1000); if (driver.FindElement(By.ClassName("uploadHot")) != null) { loginflag = true; } } catch { } while (!loginflag) { try { Thread.Sleep(1000); driver.FindElement(By.Id("user_name_login")).Clear(); driver.FindElement(By.Id("user_name_login")).SendKeys("*****@*****.**"); driver.FindElement(By.Id("passwd_login")).Clear(); driver.FindElement(By.Id("passwd_login")).SendKeys("613866"); break; } catch (Exception ex) { Console.WriteLine("当前捕捉失败,继续扫描,错误消息为" + ex.Message); } } if (!loginflag) { Console.WriteLine("登陆完成后请敲回车:enter"); Console.ReadLine(); driver.Navigate().GoToUrl(baseURL + "/v/upload"); } IWebElement approve = driver.FindElement(By.ClassName("uploadHot")); new Thread(() => { //while (true) //{ try { //if (fileupflag) break; Thread.Sleep(1000); var Autoit = new AutoItX3(); const string widowTitle = "[Class:#32770]"; Autoit.WinWait(widowTitle, "", 1); Autoit.WinActivate(widowTitle); Autoit.ControlFocus("[Class:#32770]", "", "[CLASS:Edit; INSTANCE:1]"); Autoit.Send(Filepath); Autoit.Sleep(100); Autoit.ControlClick("[Class:#32770]", "Open(O)", "Cancel"); Autoit.Sleep(100); Autoit.Send("!O"); Autoit.Send("{ENTER}", 0); //Thread.CurrentThread.Abort(); } catch (Exception ex) { Console.WriteLine("当前捕捉失败,继续扫描,错误消息为" + ex.Message); } //} //System.Diagnostics.ProcessStartInfo ImgstartInfo = new System.Diagnostics.ProcessStartInfo("fileup.exe"); //ImgstartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; //System.Diagnostics.Process.Start(ImgstartInfo); } ).Start(); approve.Click(); fileupflag = true; Thread.Sleep(2000); driver.FindElement(By.Name("memo")).Clear(); driver.FindElement(By.Name("memo")).SendKeys("qqq"); driver.FindElement(By.CssSelector("div.meta-cate.upOriginal > span")).Click(); Thread.Sleep(1000); driver.FindElement(By.LinkText("其他")).Click(); Thread.Sleep(1000); driver.FindElement(By.CssSelector("input.input-mini.meta-tags")).Clear(); driver.FindElement(By.CssSelector("input.input-mini.meta-tags")).SendKeys("qq"); Thread.Sleep(2000); driver.FindElement(By.CssSelector("span.form_btn_text")).Click(); Thread.Sleep(2000); }
internal void EditListing() { Thread.Sleep(1000); //Populate the Excel Sheet ShareSkill GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataShareSkill.xlsx", "ShareSkill"); int counts = 0; counts = Global.GlobalDefinitions.Driver.FindElements(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr")).Count; int check = 0; if (counts != 0) { for (var i = 1; i <= counts; i++) { IWebElement Title = Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[3]")); IWebElement desc = Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[" + i + "]/td[4]")); if (Title.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Title") && desc.Text == GlobalDefinitions.ExcelLib.ReadData(2, "Description")) { Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div/div[2]/div[1]/div[1]/table/tbody/tr[1]/td[8]/div/button[2]/i")).Click(); Thread.Sleep(1500); //Populate the Excel Sheet GlobalDefinitions.ExcelLib.PopulateInCollection(@"C:\Users\JIJI\source\repos\marsframework-master\MarsFramework\ExcelData\TestDataManageListings.xlsx", "EditManageListings"); //Update Title Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[1]/div/div[2]/div/div[1]/input")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Title")); //Update Description Global.GlobalDefinitions.Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[2]/div/div[2]/div[1]/textarea")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Description")); //Enter Category Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[3]/div[2]/div/div/select")).Click(); Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[3]/div[2]/div/div/select/option[7]")).Click(); Driver.FindElement(By.XPath("/ html / body / div / div / div[1] / div[2] / div / form / div[3] / div[2] / div / div[2] / div[1] / select")).Click(); Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[3]/div[2]/div/div[2]/div[1]/select/option[5]")).Click(); //Enter Tags Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[4]/div[2]/div/div/div/div/input")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Tags")); Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[4]/div[2]/div/div/div/div/input")).SendKeys(Keys.Enter); //Enter ServiceType String Service = GlobalDefinitions.ExcelLib.ReadData(2, "ServiceType"); if (Service == "One-off service") { Driver.FindElement(By.XPath("/ html / body / div / div / div[1] / div[2] / div / form / div[5] / div[2] / div[1] / div[2] / div / input")).Click(); } else { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[5]/div[2]/div[1]/div[1]/div/input")).Click(); } //Enter LocationType String LocationType = GlobalDefinitions.ExcelLib.ReadData(2, "LocationType"); if (LocationType == "On-site") { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[6]/div[2]/div/div[1]/div/input")).Click(); } else { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[6]/div[2]/div/div[2]/div/input")).Click(); } //Enter SkillTrade string SkillTrade = GlobalDefinitions.ExcelLib.ReadData(2, "SkillTrade"); if (SkillTrade == "Skill-Exchange") { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[2]/div/div[1]/div/label")).Click(); } else { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[2]/div/div[2]/div/label")).Click(); } //Enter Skill-Exchange Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Skill-Exchange")); Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input")).SendKeys(Keys.Enter); //Enter Credit if (Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[4]/div/div/div/div/div/input")).Text == "Credit") { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[8]/div[4]/div/div/input")).SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Credit")); } ////Work Sample Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[9]/div/div[2]/section/div/label/div/span/i")).Click(); AutoItX3 autoit = new AutoItX3(); autoit.WinActivate("Open"); Thread.Sleep(1500); autoit.ControlSetText("Open", "", "Edit1", StrSendText); autoit.ControlClick("Open", "", "Button1"); //Enter Active string Active = GlobalDefinitions.ExcelLib.ReadData(2, "Active"); if (Active == "Active") { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[10]/div[2]/div/div[1]/div/input")).Click(); } else { Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[10]/div[2]/div/div[2]/div/input")).Click(); } //Click on save Driver.FindElement(By.XPath("/html/body/div/div/div[1]/div[2]/div/form/div[11]/div/input[1]")).Click(); Thread.Sleep(1500); manageListingsLink.Click(); check++; return; } } return; } }
public static bool EditPowerPoint2013File() { OpenDocument(true); if (autoit.WinWaitActive("Sample AV metrics - PowerPoint", "", 20) == 1) { Thread.Sleep(2000); autoit.ControlClick("Sample AV metrics - PowerPoint", "", "NetUIHWND1", "LEFT", 1, 182, 71); Thread.Sleep(500); autoit.ControlSend("Sample AV metrics - PowerPoint", "", "mdiClass1", "Adding this line from PPT 2013 Desktop Client At: " + DateTime.Now); Thread.Sleep(2000); return(true); } else { Console.WriteLine("Unable to Find PPT doc to edit"); return(false); } }
public void Stop() { aux.ControlClick(WINTITLE, "", "WindowsForms10.BUTTON.app.0.1114f8110"); }
public void upLoad() { //Thread.Sleep(3000); //driver.FindElement(By.CssSelector("a.menuBtn_upload")).Click(); //driver.FindElement(By.CssSelector("#a-pw_add > span.icontxt")).Click(); //Thread.Sleep(1000); //Thread x = new Thread(new ThreadStart(Upload_File)); //x.Start(); //Thread.Sleep(1000); //driver.FindElement(By.CssSelector("table.table-pw_next a.btn_upload")).Click(); //Thread.Sleep(2000); ////如果进度元素不是显示100,那么继续上传 //if (driver.FindElement(By.XPath("//[@id='efaf3e61-c983-4dc3-9622-436d51d5a88c']/sapn[3]")).Text.Contains()!=100) //{ //} //下载 Thread.Sleep(1000); //driver.FindElement(By.XPath("//ul[@id='commandList']/li/table/tbody/tr/td/div/span")).Click(); ////driver.FindElement(By.CssSelector("div.fileCommand span.MixiTai_Checkbox")).Click(); ////driver.FindElement(By.XPath("//ul[@id='commandList']/li[1]/table/tbody/tr/td[2]/div/table/tbody/tr[2]/td/span")).Click(); //driver.FindElement(By.XPath("(//input[@value='Open'])")).Click(); ////driver.FindElement(By.CssSelector("a.option_Open")).Click(); //Thread.Sleep(100); ////driver.FindElement(By.CssSelector("div.fileCommand span.MixiTai_Checkbox")).Click(); //driver.FindElement(By.XPath("//ul[@id='commandList']/li/table/tbody/tr/td/div/span")).Click(); //Thread.Sleep(100); //driver.FindElement(By.XPath("(//input[@value='Open'])")).Click(); ////driver.FindElement(By.CssSelector("a.menuBtn_return > span.icontxt")).Click(); //driver.FindElement(By.XPath("//ul[@id='commandList']/li[2]/table/tbody/tr/td[2]/div/table/tbody/tr[2]/td/span")).Click(); //driver.FindElement(By.XPath("(//input[@value='Open'])[2]")).Click(); //driver.FindElement(By.CssSelector("a.menuBtn_downLoad > span.icontxt")).Click(); //driver.FindElement(By.CssSelector("a.menuBtn_downLoad > span.icontxt")).Click(); //driver.FindElement(By.XPath("//div[@id='FilesView']/div[3]/a/span")).Click(); var openFolderTableElement = driver.FindElement( By.CssSelector("table[data-name='Angkor']")); var mouseOverAction = new OpenQA.Selenium.Interactions.Actions(driver); mouseOverAction.MoveToElement(openFolderTableElement); //notice: Actions必须要执行perform mouseOverAction.Perform(); openFolderTableElement.FindElement(By.CssSelector("div.menuBtn a.option_Open")).Click(); Thread.Sleep(1000); var openFileTableElement = driver.FindElement( By.CssSelector("table[data-name='AppCertKitArmSetup.exe']")); var mouseOverAction1 = new OpenQA.Selenium.Interactions.Actions(driver); mouseOverAction1.MoveToElement(openFileTableElement); //notice: Actions必须要执行perform mouseOverAction1.Perform(); openFileTableElement.FindElement(By.CssSelector("div.menuBtn a.option_Open")).Click(); //driver.FindElement(By.LinkText("Download File")).Click(); driver.FindElement(By.CssSelector("a.menuBtn_downLoad")).Click(); Thread.Sleep(1000); var auto = new AutoItX3(); //auto.Send("{BROWSE}"); //Thread.Sleep(1000); //auto.Send("{TAB}"); //auto.Send("{TAB}"); //auto.Send("{ENTER}"); Thread.Sleep(1000); const string widowTitle = "[Class:#32770]"; auto.ControlFocus(widowTitle, "Choose Download Folder:", "[CLASS:Edit; INSTANCE:1]"); auto.Send(@"C:"); auto.ControlClick(widowTitle, "Choose Download Folder", "[CLASS:Button; INSTANCE:1]"); auto.Send("{ENTER}"); Thread.Sleep(5000); //driver.FindElement(By.LinkText("退出")).Click(); }
public void Stop() { aux.ControlClick(WINTITLE, "", "WindowsForms10.BUTTON.app.0.2c908d510"); //1 название окна, 2 текст кнопки, 3 идентификатор кнопки (локатор) }
public void clickRight(string title, int numclick, int X, int Y) { auto.ControlClick(title, "", "", "right", numclick, X, Y); }
public void Stop() { aux.ControlClick("WINTITLE", "", "WindowsForms10.BUTTON.app.0.62e44910"); }
/// <summary> /// This method will call action from Driver Class. /// </summary> /// <param name="action">Step action to perfrom by driver</param> /// <param name="parent=">Parent Object</param> /// <param name="parent"></param> /// <param name="child">Test object on which operation to be perform</param> /// <param name="data">Test Data</param> /// <param name="modifier"></param> /// <returns></returns> public void Do(string action, string parent = null, string child = null, string data = null, string modifier = "") { _snapShotOption = Property.SnapshotOption.ToLower(); //check for locator directly in test case. try { if (child != null && child.Contains("=")) { string how = child.Split('=')[0].ToLower().Trim(); string what = child.Replace(child.Split('=')[0] + "=", string.Empty); ObjDataRow[KryptonConstants.HOW] = how; ObjDataRow[KryptonConstants.WHAT] = what.Trim(); ObjDataRow[KryptonConstants.LOGICAL_NAME] = string.Empty; ObjDataRow[KryptonConstants.OBJ_TYPE] = string.Empty; ObjDataRow[KryptonConstants.MAPPING] = string.Empty; } } catch (Exception e) { Console.WriteLine(e.Message); } _stepAction = action; _testObject = child; _testData = data; //parse modifier modifier = modifier.ToLower().Trim(); int i = 1; _keywordDic.Clear();//clearing previous keyword. string browserDimension = null; //browser dimensions for (int v = 0; ; v++) { if (modifier.Contains("{")) { var stindex = modifier.IndexOf("{", StringComparison.Ordinal); modifier = modifier.Remove(stindex, 1); var endindex = modifier.IndexOf("}", StringComparison.Ordinal); string keyVariable = modifier.Substring(stindex, (endindex - stindex)); if (keyVariable.ToLower().Contains("windowsize") || keyVariable.ToLower().Contains("window")) browserDimension = keyVariable; _keywordDic.Add(i, keyVariable); i++; stindex = modifier.IndexOf("}", StringComparison.Ordinal); modifier = modifier.Remove(stindex, 1); } else { break; } } if (_keywordDic.ContainsValue("nowait")) Property.NoWait = true; else Property.NoWait = false; string stepStatus = string.Empty; bool verification = true; Utility.DriverKeydic = null; Utility.DriverKeydic = _keywordDic; // Initializing Step Description to empty, this will allow individual cases to write description if (!modifier.Contains("recovery")) // Consume last Step Description during recovery. Property.StepDescription = string.Empty; #region Simplifying the parameters before passed to Actual actions. string[] dataContent = null; string contentFirst = string.Empty; string contentSecond = string.Empty; string contentThird = string.Empty; string contentFourth = string.Empty; string contentFifth = string.Empty; if (data != null) { dataContent = data.Split(Property.Seprator); switch (dataContent.Length) { case 1: contentFirst = dataContent[0]; break; case 2: contentFirst = dataContent[0]; contentSecond = dataContent[1]; break; case 3: contentFirst = dataContent[0]; contentSecond = dataContent[1]; contentThird = dataContent[2]; break; case 4: contentFirst = dataContent[0]; contentSecond = dataContent[1]; contentThird = dataContent[2]; contentFourth = dataContent[3]; break; case 5: contentFirst = dataContent[0]; contentSecond = dataContent[1]; contentThird = dataContent[2]; contentFourth = dataContent[3]; contentFifth = dataContent[4]; break; } contentFirst = Utility.ReplaceSpecialCharactersInString(contentFirst.Trim()); contentSecond = Utility.ReplaceSpecialCharactersInString(contentSecond.Trim()); contentThird = Utility.ReplaceSpecialCharactersInString(contentThird.Trim()); contentFourth = Utility.ReplaceSpecialCharactersInString(contentFourth.Trim()); contentFifth = Utility.ReplaceSpecialCharactersInString(contentFifth.Trim()); } #endregion try { _objBrowser.SetObjDataRow(ObjDataRow); _objTestObject.SetObjDataRow(ObjDataRow, _stepAction); _objHandler = new DialogHandler(); switch (_stepAction.ToLower()) { case "waitforpage": _objTestObject.WaitForPage(contentFirst); break; //action are performed accoding to below action steps. #region Action-> settestmode case "settestmode": // Assuming page object is given and Mode is paased as a data field. Property.NoWait = true; string testModeVariable = Property.TestMode; if (!string.IsNullOrWhiteSpace(contentSecond)) { testModeVariable = Property.TestMode + "[" + contentFirst + "]"; } //Update test mode only if object could be located if (_objTestObject.VerifyObjectPresent()) { Utility.SetVariable(testModeVariable, contentSecond.ToLower().Trim()); } //Display test mode on console if debug mode is true if (Utility.GetParameter("debugmode").ToLower().Equals("true")) Property.Remarks = "Current Execution Test Mode =" + "'" + Utility.GetVariable(testModeVariable) + "'"; break; #endregion #region Action-> ShutDownDriver case "shutdowndriver": _objBrowser.Shutdown(); break; #endregion //Delete all internet temporery file. #region Action-> ClearBrowserCache case "clearbrowsercache": Property.StepDescription = "Clear Browser Cache"; BrowserManager.Browser.ClearCache(); break; #endregion //Close most recent tab of browser associated with driver. #region Action-> CloseBrowser case "closebrowser": Property.StepDescription = "Close Browser"; _objBrowser.CloseBrowser(); break; #endregion //Close All Browsers #region Action-> CloseAllBrowsers case "closeallbrowsers": if (Utility.GetParameter(Property.BrowserString).ToLower() != "android" && Utility.GetParameter(Property.BrowserString).ToLower() != "iphone" && Utility.GetParameter(Property.BrowserString).ToLower() != "selendroid") { Property.StepDescription = "Close all opened browsers."; _objBrowser.CloseAllBrowser(); } break; #endregion //Fire specified event on test object, eg.Click event. #region Action-> FireEvent case "fireevent": Property.NoWait = true; Property.StepDescription = "Fire '" + contentFirst + "' event on " + _testObject; _objTestObject.FireEvent(contentFirst); break; #endregion //Start new instance of driver and open browser with specified url #region Action->OpenBrowser case "openbrowser": string browserName = Utility.GetParameter(Property.BrowserString).ToLower(); bool deleteCookie = !modifier.ToLower().Contains("keepcookies"); Property.StepDescription = "Open a new browser and navigate to url '" + contentFirst; string remoteUrl = Property.RemoteUrl; string isRemoteExecution = Property.IsRemoteExecution; string profilePath = string.Empty; // firefoxProfilePath parameter determines whether to use Firefox Profile or not. switch (browserName) { case KryptonConstants.BROWSER_CHROME: profilePath = Utility.GetVariable("ChromeProfilePath"); break; case KryptonConstants.BROWSER_FIREFOX: profilePath = Utility.GetVariable("FirefoxProfilePath"); break; default: break; } //addonsPath parameter determines whether to load firefox addons or not. string addonsPath = Utility.GetParameter("AddonsPath"); if (contentFirst.Equals(string.Empty)) { contentFirst = Property.ApplicationUrl; } Exception openBrowserEx = null; try { _objBrowser = Browser.OpenBrowser(browserName, deleteCookie, contentFirst, isRemoteExecution, remoteUrl, profilePath, addonsPath, _datasetRecoverPopup, _datasetRecoverBrowser, _datasetOr, browserDimension); } catch (Exception ex) { openBrowserEx = ex; if (Property.IsRemoteExecution.ToLower().Equals("true")) throw ex; } _objTestObject = new Driver.TestObject(Utility.GetParameter("ObjectTimeout")); _objRecovery = new Driver.RecoveryScenarios(_datasetRecoverPopup, _datasetRecoverBrowser, _datasetOr, _objTestObject); #region Region containing JavaScript to maximize window and get Browser version string. string browserVer; Utility.SetVariable("BrowserVersion", BrowserVersion); try { browserVer = _objTestObject.ExecuteStatement("return navigator.userAgent;"); } catch (Exception) { throw openBrowserEx; } if (!browserVer.Equals(string.Empty)) { switch (browserName.ToLower()) { case KryptonConstants.BROWSER_FIREFOX: browserVer = browserVer.Substring(browserVer.IndexOf("Firefox/", StringComparison.Ordinal) + 8); if (browserVer.IndexOf('.') != browserVer.LastIndexOf('.')) browserVer = browserVer.Split('.')[0] + '.' + browserVer.Split('.')[1]; BrowserVersion = browserVer; break; case "ie": case "iexplore": case "internetexplorer": case "internet explorer": BrowserVersion = browserVer.Substring(browserVer.IndexOf("MSIE ", StringComparison.Ordinal) + 5).Split(';')[0]; string keyName = null; // Read the system registry to get the IE version in case tests are running locally if (!Utility.GetParameter("RunRemoteExecution").Equals("true", StringComparison.OrdinalIgnoreCase)) { keyName = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer"; BrowserVersion = (string)Registry.GetValue(keyName, "svcVersion", "key not found in Registry"); if (BrowserVersion.Equals("key not found in Registry")) { BrowserVersion = (string)Registry.GetValue(keyName, "Version", "key not found in Registry"); if (BrowserVersion.Equals("key not found in Registry")) // chek if version key is also not available in registry. { BrowserVersion = string.Empty; } else BrowserVersion = BrowserVersion.Split('.')[0] + "." + BrowserVersion.Split('.')[1]; } else { BrowserVersion = BrowserVersion.Split('.')[0] + "." + BrowserVersion.Split('.')[1]; } } break; case KryptonConstants.BROWSER_CHROME: browserVer = browserVer.Substring(browserVer.IndexOf("Chrome/", StringComparison.Ordinal) + 7).Split(' ')[0]; if (browserVer.IndexOf('.') != browserVer.LastIndexOf('.')) browserVer = browserVer.Split('.')[0] + '.' + browserVer.Split('.')[1]; BrowserVersion = browserVer; break; case KryptonConstants.BROWSER_OPERA: if (browserVer.Contains("Version/")) browserVer = browserVer.Substring(browserVer.IndexOf("Version/", StringComparison.Ordinal) + 8); else browserVer = browserVer.Substring(browserVer.IndexOf("Opera", StringComparison.Ordinal) + 6).Split(' ')[0]; if (browserVer.IndexOf('.') != browserVer.LastIndexOf('.')) browserVer = browserVer.Split('.')[0] + '.' + browserVer.Split('.')[1]; BrowserVersion = browserVer; break; case KryptonConstants.BROWSER_SAFARI: browserVer = browserVer.Substring(browserVer.IndexOf("Version/", StringComparison.Ordinal) + 8).Split(' ')[0]; if (browserVer.IndexOf('.') != browserVer.LastIndexOf('.')) browserVer = browserVer.Split('.')[0] + '.' + browserVer.Split('.')[1]; BrowserVersion = browserVer; break; } } #endregion Utility.SetVariable("BrowserVersion", BrowserVersion); _objBrowser.SetObjDataRow(ObjDataRow); Utility.SetVariable(Property.BrowserVersion, BrowserVersion); break; #endregion //Navigate to back on current web page #region Action->GoBack case "goback": _objBrowser.GoBack(); Property.StepDescription = "Go backwards in the browser"; break; #endregion //Navigate to forward on current web page. : #region Action->GoForward case "goforward": Property.StepDescription = "Go forward in the browser"; _objBrowser.GoForward(); break; #endregion //Refresh current web page. : #region Action->RefreshBrowser case "refreshbrowser": Property.StepDescription = "Refresh browser"; _objBrowser.Refresh(); break; #endregion case "switchtorecentbrowser": case "switchtonewbrowser": Property.StepDescription = "Set focus to most recently opened window"; _objBrowser.SetBrowserFocus(); break; //Navigate to new specified url in current web page. #region Action->NavigateURL case "navigateurl": Property.StepDescription = "Navigate to url '" + contentFirst + "' in currently opened browser"; if (!contentFirst.StartsWith(@"http://")) contentFirst = @"http://" + contentFirst; _objBrowser.NavigationUrl(contentFirst); break; #endregion //Clear existing data from test object. case "clear": case "cleartext": Property.StepDescription = "Clear object '" + _testObject + "'"; _objTestObject.ClearText(); break; //Check radio button and check box. case "check": Property.StepDescription = "Check '" + contentFirst + "' checkbox '" + _testObject + "'"; _objTestObject.Check(contentFirst); break; //Uncheck radio button and check box. : case "uncheck": Property.StepDescription = "Uncheck checkbox '" + _testObject + "'"; _objTestObject.UnCheck(); break; case "checkmultiple": Property.StepDescription = "Check multiple checkboxes of '" + _testObject + "'"; _objTestObject.CheckMultiple(dataContent); break; case "uncheckmultiple": Property.StepDescription = "Uncheck multiple checkboxes of '" + _testObject + "'"; string[] dataC = data.Split(Property.Seprator); _objTestObject.UncheckMultiple(dataC); break; case "swipeobject": Property.StepDescription = "swipe object in " + contentFirst + " direction " + _testObject; Utility.SetVariable(_testObject, contentFirst); break; //Perform click action on associated test object. : #region Action->Click case "click": Property.StepDescription = "Click on '" + _testObject + "'"; DateTime dtbefore = new DateTime(); if (ObjDataRow.ContainsKey(KryptonConstants.OBJ_TYPE) && ObjDataRow[KryptonConstants.OBJ_TYPE].ToLower().Contains("winbutton")) { dtbefore = DateTime.Now; if (ObjDataRow.ContainsKey(KryptonConstants.OBJ_TYPE) && ObjDataRow[KryptonConstants.OBJ_TYPE].ToLower().Contains("winbutton") && Property.IsRemoteExecution.ToLower().Equals("true")) { // do nothing } else { var autoit = new AutoItX3(); string[] windowDetail = Regex.Split(ObjDataRow[KryptonConstants.WHAT], "//"); autoit.WinActivate(windowDetail[0], string.Empty); autoit.ControlClick(windowDetail[0], string.Empty, windowDetail[1]); } } else { _objTestObject.Click(_keywordDic, data); } break; #endregion case "doubleclick": Property.StepDescription = "Double click on '" + _testObject + "'"; _objTestObject.DoubleClick(); break; #endregion //Enter unique data in test object. #region Action-> EnterUniqueData case "enteruniquedata": Property.StepDescription = "Enter unique string of " + contentFirst + " characters in " + _testObject; int length = Convert.ToInt16(contentFirst); //passing length value if mentioned in test case. string strUnique = Utility.GenerateUniqueString(length); Utility.SetVariable(_testObject, strUnique); _objTestObject.SendKeys(strUnique); break; #endregion //Enter specified data in test object. : case "enterdata": case "type": #region Action->TypeString case "typestring": if (contentFirst.Equals("ON", StringComparison.CurrentCultureIgnoreCase)) _stepAction = "Check"; if (contentFirst.Equals("OFF", StringComparison.CurrentCultureIgnoreCase)) _stepAction = "Unchek"; Property.StepDescription = "Enter text " + contentFirst + " in " + _testObject; Utility.SetVariable(_testObject, contentFirst);//implicitely set key/Value to runtimedic dictionary before enter any data. if (ObjDataRow.ContainsKey(KryptonConstants.OBJ_TYPE) && ObjDataRow[KryptonConstants.OBJ_TYPE].ToLower().Equals("winedit")) { if (ObjDataRow.ContainsKey(KryptonConstants.OBJ_TYPE) && ObjDataRow[KryptonConstants.OBJ_TYPE].ToLower().Contains("winedit") && Property.IsRemoteExecution.ToLower().Equals("true")) { UploadFileOnRemote oUploadFileOnRemote = new UploadFileOnRemote(Utility.GetParameter("browser"), Property.RemoteMachineIP, contentFirst.Trim()); oUploadFileOnRemote.UploadFileWithAutoIt(); } else _objHandler.EnterdataInDialog(contentFirst); } else { _objTestObject.SendKeys(contentFirst); } break; #endregion #region Action->UploadFileOnRemote #if(DEBUG) //used unly for dev testing purpose case "uploadfileonremote": if (Property.IsRemoteExecution.ToLower().Equals("true")) { Property.StepDescription = "Upload file " + contentFirst; UploadFileOnRemote oUploadFileOnRemote = new UploadFileOnRemote(Utility.GetParameter("browser"), Property.RemoteMachineIP, contentFirst); oUploadFileOnRemote.UploadFileWithAutoIt(); } break; #endif #endregion //Press non alphabetic key. #region Action->KeyPress case "keypress": Property.StepDescription = "Press key " + contentFirst + " on " + _testObject; _objTestObject.KeyPress(contentFirst); break; #endregion //Adding submit in case this helps when clicks are missing. #region Action->Submit case "submit": Property.StepDescription = "Submit " + _testObject; _objTestObject.Submit(); break; #endregion //Perform wait action for specified time duration. case "pause": #region Action->Wait case "wait": Property.StepDescription = "Pause execution for " + contentFirst + " seconds"; browserName = Utility.GetParameter(Property.BrowserString).ToLower(); _objBrowser.Wait(contentFirst); break; #endregion //Select option form List. #region Action->SelectItem case "selectitem": Property.StepDescription = "Select '" + contentFirst + "' from " + _testObject; Utility.SetVariable(_testObject, contentFirst); _objTestObject.SelectItem(dataContent); break; #endregion //Select multiple options form List. case "selectmultipleitems": case "selectmultipleitem": #region Action->SelectItems case "selectitems": Property.StepDescription = "Select multiple items '" + data + "' from " + _testObject; Utility.SetVariable(_testObject, data); _objTestObject.SelectItem(dataContent, true); break; #endregion //Select option from List on the besis of index. #region Action-> SelectItemByIndex case "selectitembyindex": Property.StepDescription = "Select " + contentFirst + "th item from " + _testObject; string optionValue = _objTestObject.SelectItemByIndex(contentFirst); Utility.SetVariable(_testObject, optionValue); break; #endregion //Wait for a specified condition to be happened on test object. #region Action->WaitForObject case "waitforobject": Property.StepDescription = "Wait until " + _testObject + " becomes available"; string actualwaitTime = _objTestObject.WaitForObject(contentFirst, _globalTimeout, _keywordDic, modifier.ToLower()); break; #endregion //Wait for a specified condition to be happened on test object. #region Action->WaitForObjectNotPresent case "waitforobjectnotpresent": Property.StepDescription = "Wait until " + _testObject + " disappears"; _objTestObject.WaitForObjectNotPresent(contentFirst, _globalTimeout, _keywordDic); break; #endregion //Wait for specified property to enable. : #region Action->WaitForProperty case "waitforproperty": Property.StepDescription = "Wait for " + _testObject + " to achieve value '" + contentSecond + "' for '" + contentFirst + "' property"; _objTestObject.WaitForObjectProperty(contentFirst, contentSecond, _globalTimeout, _keywordDic); break; #endregion //Accept alert : #region Action->AcceptAlert case "acceptalert": Property.StepDescription = "Accept alert"; _objBrowser.AlertAccept(); break; #endregion #region Action->DismissAlert case "dismissalert": _objBrowser.AlertDismiss(); break; #endregion //Verify text on alert page. : #region Action->VerifyAlertText case "verifyalerttext": Property.StepDescription = "Verify alert contains text '" + contentFirst + "'"; verification = _objBrowser.VerifyAlertText(contentFirst, _keywordDic); break; #endregion //Get value of specified property of test object. : case "getattribute": #region Action->GetObjectProperty case "getobjectproperty": string property = contentFirst.Trim(); string propertyVariable = _testObject + "." + property; if (!contentSecond.Equals(String.Empty)) propertyVariable = contentSecond.Trim(); string propertyValue = _objTestObject.GetObjectProperty(property); Utility.SetVariable(propertyVariable, propertyValue); break; #endregion //set property present in DOM #region Action->SetAttribute case "setattribute": property = contentFirst.Trim(); propertyValue = contentSecond.Trim(); _objTestObject.SetAttribute(property, propertyValue); break; #endregion //Get value of specified property of current web page. : #region Action->GetPageProperty case "getpageproperty": propertyValue = _objBrowser.GetPageProperty(contentFirst.Trim()); propertyVariable = parent + "." + contentFirst.Trim(); if (!contentSecond.Equals(String.Empty)) propertyVariable = contentSecond.Trim(); Utility.SetVariable(propertyVariable, propertyValue); break; #endregion //Verify that specified text is present on current web page or test object. : case "verifytextcontained": #region Action->VerifyTextPresent case "verifytextpresent": //- In case of text on page, Dictionary will be empty ie- count= 0. if (ObjDataRow.Count == 0) { verification = _objBrowser.VerifyTextPresentOnPage(contentFirst, _keywordDic); } else { verification = _objTestObject.VerifyObjectProperty("text", contentFirst, _keywordDic); } break; #endregion //Verify that specified text is present on current web page or test object. : case "verifytextnotcontained": #region Action->VerifyTextNotPresent case "verifytextnotpresent": if (ObjDataRow[KryptonConstants.HOW].Equals(string.Empty) || ObjDataRow[KryptonConstants.WHAT].Equals(string.Empty) || ObjDataRow[KryptonConstants.HOW] == null || ObjDataRow[KryptonConstants.WHAT] == null || ObjDataRow[KryptonConstants.HOW].ToLower().Equals("url")) { verification = !_objBrowser.VerifyTextPresentOnPage(contentFirst, _keywordDic); } else { verification = _objTestObject.VerifyObjectPropertyNot("text", contentFirst, _keywordDic); } break; #endregion //Verify that specified text is present on current web page. : #region Action->VerifyTextOnPage case "verifytextonpage": verification = _objBrowser.VerifyTextPresentOnPage(contentFirst, _keywordDic); if (verification) Property.StepDescription = "The Text : " + contentFirst + " was present on the page"; else Property.StepDescription = "The Text : " + contentFirst + " was NOT present on the page"; break; #endregion //Verify that specified text is not present on current web page. : #region Action-> VerifyTextNotOnPage case "verifytextnotonpage": verification = !_objBrowser.VerifyTextPresentOnPage(contentFirst, _keywordDic); if (verification) { stepStatus = ExecutionStatus.Pass; Property.Remarks = "Text : \"" + contentFirst + "\" is not found on current Page."; } else { stepStatus = ExecutionStatus.Fail; Property.Remarks = "Text : \"" + contentFirst + "\" is found on current Page."; } break; #endregion //Verify that List option is persent in focused List. : case "verifylistitempresent": verification = _objTestObject.VerifyListItemPresent(contentFirst); break; //Verify that List option is not persent in focused List. : case "verifylistitemnotpresent": verification = _objTestObject.VerifyListItemNotPresent(contentFirst); break; //Verify that specified test object is present on current web page. : #region Action->VerifyObjectPresent case "verifyobjectpresent": verification = _objTestObject.VerifyObjectPresent(); break; #endregion //Verify that specified test object is present on current web page. : case "verifyobjectnotpresent": verification = _objTestObject.VerifyObjectNotPresent(); break; //Verify test object property. : #region Action-> VerifyObjectProperty case "verifyobjectproperty": property = contentFirst.Trim(); propertyValue = contentSecond.Trim(); verification = _objTestObject.VerifyObjectProperty(property, propertyValue, _keywordDic); break; #endregion //Verify test object property not present. : #region Action-> VerifyObjectNotPresent case "verifyobjectpropertynot": property = contentFirst.Trim(); propertyValue = contentSecond.Trim(); verification = _objTestObject.VerifyObjectPropertyNot(property, propertyValue, _keywordDic); break; #endregion //Verify current web page property. : #region Action->VerifyPageProperty case "verifypageproperty": property = _testData.Substring(0, _testData.IndexOf('|')).Trim(); propertyValue = _testData.Substring(_testData.IndexOf('|') + 1).Trim(); // Replace special characters after trimming off white spaces. property = Utility.ReplaceSpecialCharactersInString(property); propertyValue = Utility.ReplaceSpecialCharactersInString(propertyValue); verification = _objBrowser.VerifyPageProperty(property, propertyValue, _keywordDic); break; #endregion //Verify that specified text is present in web page view source. : #region Action-> VerifyTextInPageSource case "verifytextinpagesource": verification = _objBrowser.VerifyTextInPageSource(contentFirst, _keywordDic); break; #endregion //Verify specified text not in webpage view-source. #region Action->VerifyTextNotPageSource case "verifytextnotinpagesource": verification = !_objBrowser.VerifyTextInPageSource(contentFirst, _keywordDic); break; #endregion //Verify that current web page is display properly. case "verifypagedisplayed": verification = _objBrowser.VerifyPageDisplayed(_keywordDic); break; //Synchronize object with specified condition. case "syncobject": _objTestObject.WaitForObject(contentFirst, _globalTimeout, _keywordDic, modifier); break; //Verify that object is dispaly properly. case "verifyobjectdisplayed": verification = _objTestObject.VerifyObjectDisplayed(); break; //Execute specified script language. #region Action->ExecuteStatement | ExecuteScript case "executescript": case "executestatement": Property.NoWait = true; string scriptResult = _objTestObject.ExecuteStatement(contentFirst); if (scriptResult.ToLower().Equals("false")) verification = false; else if (!scriptResult.ToLower().Equals("true")) Utility.SetVariable(_testObject, scriptResult); break; #endregion //Retrieve all numbers from text. case "getnumberfromtext": Utility.GetNumberFromText(contentFirst); break; #region Action->SetVariable case "setvariable": string varName = contentFirst.Trim(); string varValue = contentSecond.Trim(); //ReplaceVariablesInString will find value from $variable varValue = Utility.ReplaceVariablesInString(varValue); Property.StepDescription = "Store " + varValue + " to variable named " + varName; //set variable Utility.SetVariable(varName, varValue); verification = true; //should this step need to be captured in the log file as pass/fail? break; #endregion #region Action->SetParameter case "setparameter": string varName1 = contentFirst.Trim(); string varValue1 = contentSecond.Trim(); //ReplaceVariablesInString will find value from $variable varValue = Utility.ReplaceVariablesInString(varValue1); Property.StepDescription = "Store " + varValue1 + " to variable named " + varName1; //set parameter Utility.SetParameter(varName1, varValue1); //set variable Utility.SetVariable(varName1, varValue1); verification = true; break; #endregion case "getdatafromdatabase": verification = DBRelatedMethods.GetDataFromDatabase(contentFirst, child); _verificationMessage = Property.Remarks; break; #region Action-> GetUserTesting case "getuserfortesting": //it will work same as method "GetDataFromDatabase". If GetUserForTesting returns false, test case execution will be stopped. try { verification = DBRelatedMethods.GetDataFromDatabase(contentFirst, child); _verificationMessage = Property.Remarks; //Try once again in case this fails if (verification == false) { verification = DBRelatedMethods.GetDataFromDatabase(contentFirst, child); _verificationMessage = Property.Remarks; } if (verification == false) Property.EndExecutionFlag = true; } catch { Property.EndExecutionFlag = true; } break; #endregion case "executedatabasequery": verification = DBRelatedMethods.ExecuteDatabaseQuery(contentFirst, child); _verificationMessage = Property.Remarks; break; case "verifydatabase": verification = DBRelatedMethods.VerifyDatabase(contentFirst, child); _verificationMessage = Property.Remarks; break; #region Action->RequestWebService case "requestwebservice": string requestHeader = Utility.ReplaceVariablesInString(Utility.GetVariable("[TD]Header")); string responseFormat = Utility.ReplaceVariablesInString(Utility.GetVariable("[TD]Format")); string requestMethod = Utility.ReplaceVariablesInString(Utility.GetVariable("[TD]Method")); string requestUrl = Utility.ReplaceVariablesInString(Utility.GetVariable("[TD]ServiceURL")); string requestBody = Utility.ReplaceVariablesInString(Utility.GetVariable("[TD]Body")); Property.StepDescription = "Request web service using method '" + requestMethod + "' and url '" + requestUrl + "'."; verification = WebAPI.RequestWebService(requestHeader, responseFormat, requestMethod, requestUrl, requestBody); _verificationMessage = Property.Remarks; break; #endregion case "downloadfile": case "filedownload": #region Action->Download case "download": Property.StepDescription = "Download file from url: " + contentFirst; verification = WebAPI.DownloadFile(contentFirst, contentSecond); _verificationMessage = Property.Remarks; break; #endregion #region Action-> FTPFileUpload case "ftpfileupload": Property.StepDescription = "Upload file: " + contentFourth + "to ftp server: " + contentFirst; string hostName = contentFirst; string userName = contentSecond; string password = contentThird; string filePath = contentFourth; string uploadedFileName = contentFifth; string url = string.Empty; if (String.IsNullOrEmpty(uploadedFileName)) { url = "ftp://" + hostName + "/" + Path.GetFileName(filePath); } else { url = "ftp://" + hostName + "/" + uploadedFileName; } Uri uploadUrl = new Uri(url); verification = WebAPI.UploadFiletoFtp(filePath, uploadUrl, userName, password); _verificationMessage = Property.Remarks; break; #endregion #region Action-> ReadXMLAttribute case "readxmlattribute": Property.StepDescription = "Read value of attribute '" + contentFirst.Trim() + "' and store to run time variable '" + contentFirst.Trim() + "'."; //Pass on node index required as a seconf argument if provided in test data if (!contentSecond.Equals(String.Empty)) { try { verification = WebAPI.ReadXmlAttribute(contentFirst.Trim(), Convert.ToInt16(contentSecond.Trim())); } catch (Exception) { verification = WebAPI.ReadXmlAttribute(contentFirst.Trim()); } } else { verification = WebAPI.ReadXmlAttribute(contentFirst.Trim()); } _verificationMessage = Property.Remarks; break; #endregion case "findxmlattribute": case "locatexmlattribute": #region Action-> GetXMLAttributePosition case "getxmlattributeposition": Property.StepDescription = "Find relative location (index) of attribute '" + contentFirst.Trim() + "' where value of attribute should be '" + contentSecond.Trim() + "'."; verification = WebAPI.ReadXmlAttribute(contentFirst.Trim(), 1, contentSecond.Trim()); _verificationMessage = Property.Remarks; break; #endregion // New step action added as per the need of G3 API automation testing team case "verifyxmlattributenotpresent": verification = !WebAPI.ReadXmlAttribute(contentFirst.Trim(), 1, contentSecond.Trim()); if (!verification) Property.Remarks = "Value '" + contentSecond.Trim() + "' of attribute '" + contentFirst.Trim() + "' found in api response. "; else Property.Remarks = "Value '" + contentSecond.Trim() + "' of attribute '" + contentFirst.Trim() + "' was not present in api response. "; ; _verificationMessage = Property.Remarks; break; #region Action-> VerifyXMLAttribute case "verifyxmlattribute": Property.StepDescription = "Verify value of attribute '" + contentFirst.Trim() + "' equals to '" + contentSecond.Trim() + "'."; //Third attribute is considered to be if (contentThird.Equals(string.Empty)) { contentThird = "1"; } verification = WebAPI.VerifyXmlAttribute(contentFirst.Trim(), contentSecond.Trim(), int.Parse(contentThird)); _verificationMessage = Property.Remarks; break; #endregion #region Action->VerifyXMLHeader case "verifyxmlheader": verification = WebAPI.VerifyXmlHeader(contentFirst.Trim(), contentSecond.Trim()); if (verification) { Property.Remarks = contentFirst.Trim() +" "+contentSecond.Trim() + " Found in the Request Header."; } else Property.Remarks = contentFirst.Trim() +" "+contentSecond.Trim() + " Not found in the Request Header."; _verificationMessage = Property.Remarks; break; #endregion #region Action-> CountXMLNodes case "countxmlnodes": Property.StepDescription = "Count all instances of attribute '" + contentFirst + "' and store to variable '" + contentFirst.Trim() + "Count'"; verification = WebAPI.CountXmlNodes(contentFirst.Trim()); _verificationMessage = Property.Remarks; break; #endregion #region Action-> VerifyXMLNodeCount case "verifyxmlnodecount": Property.StepDescription = "Verify count of all instances of attribute '" + contentFirst.ToString().Trim() + "' equals to '" + contentSecond.ToString().Trim() + "'."; verification = WebAPI.Verifyxmlnodecount(contentFirst.ToString().Trim(), contentSecond.ToString().Trim()); _verificationMessage = Property.Remarks; break; #endregion // this method will split data column, generate random number on the basis of start index and end index and assign to variable // #region Action-> GenerateRandomNumber case "generaterandomnumber": int startIntValue = int.Parse(Utility.ReplaceVariablesInString(contentFirst.Trim())); int endIntValue = int.Parse(Utility.ReplaceVariablesInString(contentSecond.Trim())); string generateParamName = string.Empty; if (!contentThird.Equals(String.Empty)) generateParamName = Utility.ReplaceVariablesInString(contentThird.Trim()); else generateParamName = Property.GenerateRandomNumberParamName; //by default harcoded variable int rndVal = Utility.RandomNumber(startIntValue, endIntValue + 1); //set variable Utility.SetVariable(generateParamName, rndVal.ToString()); break; #endregion //this method will split data column, generate random number on the basis of start index and end index and assign to variable // #region Action-> GenerateUniqueString case "generateuniquestring": int startIntValue1 = int.Parse(Utility.ReplaceVariablesInString(contentFirst.Trim())); string endIntValue1 = Utility.ReplaceVariablesInString(contentSecond.Trim()); string generateParamName1 = string.Empty; if (string.IsNullOrWhiteSpace(endIntValue1) == false) generateParamName1 = endIntValue1; else generateParamName1 = Property.GenerateRandomStringParamName; //by default harcoded variable string rndVal1 = Utility.RandomString(startIntValue1); //set variable Utility.SetVariable(generateParamName1, rndVal1.ToString()); Property.StepDescription = "Generate unique string of length " + startIntValue1; Property.Remarks = "Generated string:= " + rndVal1.ToString(); break; #endregion //This action generates a 10 digit unique number where first digit will not be 0 or 1. //Also stores each digit in ten different variables named as: Char1, Char2, ... , Char10 #region Action-> GenerateUniqueMobileNo. case "generateuniquemobileno": string uniqueMobile = Utility.GenerateUniqueNumeral(10); // Check if first digit is '1' then replace it with '4' if (uniqueMobile[0] == '0' || uniqueMobile[0] == '1') uniqueMobile = uniqueMobile.Replace(uniqueMobile[0], '4'); // Store generated mobile number into the dictionary Utility.SetVariable("MobileNo", uniqueMobile); // Also store each character of mobile number into the dictionary for (int j = 1; j <= uniqueMobile.Length; j++) Utility.SetVariable("Char" + j.ToString(), uniqueMobile[j - 1].ToString()); Property.StepDescription = "Generate unique mobile number and store to variable: 'MobileNo'"; Property.Remarks = "Generated mobile no:= " + uniqueMobile.ToString(); break; #endregion case "mousemove": _objTestObject.MouseMove(); break; //Performs click using advanced user interaction API case "mouseclick": _objTestObject.MouseClick(); break; //Performs mouseover using advanced user interaction API case "mouseover": _objTestObject.MouseOver(); break; case "{ignore}": case "{IGNORE}": case "{SKIP}": case "{skip}": stepStatus = ExecutionStatus.Pass; break; //Builds an advanced user interaction API object, which should later be used by "performAction" keyword // Multiple addAction statements can be clubbed one after another, and they will be executed in a chain fashion #region Action-> AddAction case "addaction": _objTestObject.AddAction(contentFirst, contentSecond); break; #endregion //Performs actions build using "addAction" keyword using advanced user interaction API #region Action-> PerformAction case "performaction": _objTestObject.PerformAction(); break; #endregion #region Action-> VerifySortOrder case "verifysortorder": Property.StepDescription = "Verify sort order with Property " + "'" + contentFirst + "'" + " and sort order " + "'" + contentSecond + "'"; verification = _objTestObject.VerifySortOrder(contentFirst, contentSecond); break; #endregion #region Action-> DragAndDrop case "draganddrop": Property.StepDescription = "Drag " + _testObject + " and drop to " + contentFirst; _objTestObject.DragAndDrop(ObjSecondDataRow); break; #endregion #region Action-> saveContentsoffile case "savecontentstofile": string contents = contentFirst; string filename = "CustomTagsFile.txt"; if (!_testObject.Equals(string.Empty)) { filename = _testObject; } string filepath = Property.ResultsSourcePath + "\\" + filename; string varname = filename.Split('.')[0].ToString(); Utility.Savecontentstofile(filepath, contents); Utility.SetVariable(varname, filepath); Property.Remarks = "Data Content has been stored to file '" + filename + "'.Its location has been stored in a variable '" + varname + "'."; break; #endregion #region UploadFile PBI : #205 case "uploadfile": Property.StepDescription = "Upload file at location " + contentFirst; verification = _objTestObject.UploadFile(contentFirst, contentSecond); if (verification == false) { Property.Remarks = "File not found at location " + contentFirst; } break; #endregion default: { Property.Remarks = _stepAction + ":" + Utility.GetCommonMsgVariable("KRYPTONERRCODE0025"); verification = false; stepStatus = ExecutionStatus.Fail; } break; } if (!stepStatus.Equals(ExecutionStatus.Warning)) { stepStatus = verification ? ExecutionStatus.Pass : ExecutionStatus.Fail; } } catch (Exception e) { if (modifier.Contains("recovery")) { throw new Exception(Utility.GetCommonMsgVariable("KRYPTONERRCODE0024")); } Property.Remarks = _stepAction + ":" + e.Message; stepStatus = ExecutionStatus.Fail; //Overriding cache errors that appears on saucelabs //seen when testing for angieslist if (e.Message.IndexOf("getElementTagName execution failed; Element does not exist in cache", StringComparison.OrdinalIgnoreCase) >= 0) stepStatus = ExecutionStatus.Warning; if (e.Message.IndexOf("Element not found in the cache", StringComparison.OrdinalIgnoreCase) >= 0) stepStatus = ExecutionStatus.Pass; //Overriding timeouts to warning instead of failure if (e.Message.IndexOf(Exceptions.ERROR_NORESPONSEURL, StringComparison.OrdinalIgnoreCase) >= 0) stepStatus = ExecutionStatus.Warning; if (e.Message.IndexOf("docElement is null", StringComparison.OrdinalIgnoreCase) >= 0) stepStatus = ExecutionStatus.Warning; //When this message appears, click has been successfull, just the error appears if (e.Message.IndexOf("Cannot click on element", StringComparison.OrdinalIgnoreCase) >= 0) stepStatus = ExecutionStatus.Warning; //Overriding click timeout to waring instead of failure if (e.Message.IndexOf("Timed out after", StringComparison.OrdinalIgnoreCase) >= 0 || e.Message.IndexOf("Page load is taking longer time.", StringComparison.OrdinalIgnoreCase) >= 0) stepStatus = ExecutionStatus.Warning; //Overriding timeout to warning instead of failure. if (e.Message.IndexOf("win is null", StringComparison.OrdinalIgnoreCase) >= 0) stepStatus = ExecutionStatus.Warning; //Modal dialog present Execption does,t interrupt normal Execution if (e.Message.IndexOf("Modal dialog", StringComparison.OrdinalIgnoreCase) >= 0) { Property.Remarks = string.Empty; stepStatus = ExecutionStatus.Pass; } } Property.Status = stepStatus; if (_snapShotOption.ToLower().Equals("always") || (_snapShotOption.ToLower().Equals("on page change") && (action.ToLower().Equals("click") || action.ToLower().Equals("openbrowser") || action.ToLower().Equals("closebrowser") || action.ToLower().Equals("navigateurl") || action.ToLower().Equals("goback") || action.ToLower().Equals("refreshbrowser") || action.ToLower().Equals("goforward") || action.ToLower().Equals("switchtorecentbrowser") || action.ToLower().Equals("switchtonewbrowser") || action.ToLower().Equals("doubleclick") || action.ToLower().Equals("submit") )) || (stepStatus.Equals(ExecutionStatus.Fail) && !_snapShotOption.ToLower().Equals("never") && !action.Contains(".")) ) { SaveSnapShots(action); } if (_keywordDic.ContainsValue("endtestonfailure") && stepStatus.Equals(ExecutionStatus.Fail)) { Property.EndExecutionFlag = true; } if (_testObject != null && parent != null && Property.StepDescription.Equals(string.Empty)) { if (!_testObject.Equals(string.Empty) && !parent.Equals(string.Empty)) Property.StepDescription = _stepAction + " on test object \"" + _testObject + "\" in page \"" + parent + " \"."; else Property.StepDescription = _stepAction; //For actions in which Parent and TestObject doesn't use like closeAllBrowsers etc. } }