static void Main(string[] args)
        {
            AutoItX3Lib.AutoItX3 robot = new AutoItX3Lib.AutoItX3();
            testCase tc = new testCase();
            bool INCREASING = true;
            bool DECREASING = false;

            //line 2 increasing
            //tc.runTestcase("Line 2", 230.8, 224, 5, INCREASING);
            //robot.Sleep(1000);

            //line 2 decreasing
            tc.runTestcase("Line 2", 230.8, 224, 5, DECREASING);
            //robot.Sleep(1000);

            //line 4 increasing
            //tc.runTestcase(4, 200, 220, true);
            //robot.Sleep(1000);

            //line 4 decreasing
            //tc.runTestcase(4, 220, 200, false);
            //robot.Sleep(1000);

            //line 2 and 7 increasing
            //tc.runTestcase(2, 7, 200, 220, true);
            //robot.Sleep(1000);

            //line 2 and 7 decreasing
            //tc.runTestcase(2, 7, 200, 220, false);
            //robot.Sleep(1000);
        }
        static void Main(string[] args)
        {
            AutoItX3Lib.AutoItX3 robot = new AutoItX3Lib.AutoItX3();

            testCase tc = new testCase();
            //line 2 increasing
            tc.runTestcase(2, 210, 220, true);
            robot.Sleep(1000);

            //line 2 decreasing
            //tc.runTestcase(2, 220, 200, false);
            //robot.Sleep(1000);

            //line 4 increasing
            //tc.runTestcase(4, 200, 220, true);
            //robot.Sleep(1000);

            //line 4 decreasing
            //tc.runTestcase(4, 220, 200, false);
            //robot.Sleep(1000);

            //line 2 and 7 increasing
            //tc.runTestcase(2, 7, 200, 220, true);
            //robot.Sleep(1000);

            //line 2 and 7 decreasing
            //tc.runTestcase(2, 7, 200, 220, false);
            //robot.Sleep(1000);
        }
Example #3
0
        private void LoginWithAutoIt(string url)
        {
            int count = 0;

            // do
            // {
            webDriver.Navigate().GoToUrl(url);
            Thread.Sleep(3000);
            AutoItX3Lib.AutoItX3 auto = new AutoItX3Lib.AutoItX3();

            var AutoIT = new AutoItX3();
            int result = AutoIT.WinWait("Authentication Required", "", 10);

            Console.WriteLine(result);
            //  if (AutoIT.WinExists("Authentication Required", ""))
            {
                AutoIT.WinActivate("Authentication Required");
                AutoIT.Send("tikdepzai");
                Thread.Sleep(300);
                AutoIT.Send("{TAB}");
                Thread.Sleep(300);
                AutoIT.Send("Thewings123");
                Thread.Sleep(300);
                AutoIT.Send("{ENTER}");
            }
            //else
            //{
            //    break;
            //}
            Thread.Sleep(3000);
            Console.WriteLine("count: " + (count++));
            // } while (true);

            //if (AutoItX.WinExists("Authentication Required"))
            //    {

            //}
            //   AutoItX.WinActivate("Authentication Required")
            //   AutoItX.Send($CmdLine[1])
            //   AutoItX.Send("{TAB}")
            //   AutoItX.Send($CmdLine[2])
            //   AutoItX.Send("{ENTER}")
        }
Example #4
0
        public static Boolean driveFromExcel(string excelfilePath)
        {
            try
            {

                DataTable dtResultSummary = new DataTable();
                dtResultSummary.Columns.Add("SNO");
                dtResultSummary.Columns.Add("SCRIPTNAME");
                dtResultSummary.Columns.Add("COMMENT");
                dtResultSummary.Columns.Add("ACTION");
                dtResultSummary.Columns.Add("ARGUMENT");
                dtResultSummary.Columns.Add("RESULT");
                dtResultSummary.Columns.Add("TIMETAKEN");
                dtResultSummary.Columns.Add("MESSAGE");
                string keyWord = ""; string stpexecute = ""; string stepFrom = ""; string comment = "";
                string arg1 = ""; string arg2 = ""; string arg3 = ""; string arg4 = ""; string arg5 = "";
                Helper.TestDataManagement driverData = new Helper.TestDataManagement();
                string _epath = ConfigurationManager.AppSettings["logfile"];
                string apppath = ConfigurationManager.AppSettings["apppath"];
                string reportsSectionFile = ConfigurationManager.AppSettings["reportssectionfile"];
                string strfile = ConfigurationManager.AppSettings["driverfile"];


                Boolean returndriveFromExcel = true;
                Boolean _usewhite = Boolean.Parse(ConfigurationManager.AppSettings["usewhite"]);
                Boolean _detlog = Boolean.Parse(ConfigurationManager.AppSettings["Detaillog"]);

                //*************** 1. Launch Wellflo application ************************************

                //WPF_App.WpfAction wpfaction = new WPF_App.WpfAction();
                UIAutomation_App.UIAutomationAction uiautomation = new UIAutomation_App.UIAutomationAction();
                uiautomation._Attempts = _attempt;
                uiautomation.UseWhite = _usewhite;
                uiautomation._eLogPtah = _epath;
                uiautomation._reportsPath = _reportsPath;
                uiautomation._reportsSectionPath = reportsSectionFile;
                uiautomation.UseDetaillog = _detlog;
                Helper.TestDataManagement testdataobj = new Helper.TestDataManagement();
                Helper.LogManagement logg = new Helper.LogManagement();
                WellFloUI.MSUIAutomation wellflocomui = new WellFloUI.MSUIAutomation();
                uiautomation._testDataPath = _strPath;
                AutoItX3Lib.AutoItX3 autoit = new AutoItX3Lib.AutoItX3();
                Helper.ReportsManagement rpt = new Helper.ReportsManagement();

                driverData.GetTestData(excelfilePath, "Tmaster");

                int pascount = 0;
                int failcount = 0;

                for (int i = 0; i < driverData.Structure.Rows.Count; i++)
                {
                    System.Diagnostics.Stopwatch stopwatch3 = new System.Diagnostics.Stopwatch();
                    stopwatch3.Start();
                    DataRow dr = dtResultSummary.NewRow();
                    comment = driverData.Structure.Rows[i]["Comment"].ToString();
                    keyWord = driverData.Structure.Rows[i]["Keyword"].ToString();
                    stpexecute = driverData.Structure.Rows[i]["Execute"].ToString();
                    stepFrom = driverData.Structure.Rows[i]["StepFrom"].ToString();
                    arg1 = driverData.Structure.Rows[i]["arg1"].ToString();
                    arg2 = driverData.Structure.Rows[i]["arg2"].ToString();
                    arg3 = driverData.Structure.Rows[i]["arg3"].ToString();
                    arg4 = driverData.Structure.Rows[i]["arg4"].ToString();
                    arg5 = driverData.Structure.Rows[i]["arg5"].ToString();
                    dr["SCRIPTNAME"] = _scriptName;
                    dr["SNO"] = (sNo + 1).ToString();
                    dr["ACTION"] = keyWord;
                    if (comment == null)
                    {
                        dr["COMMENT"] = " ";
                    }
                    else
                    {
                        dr["COMMENT"] = comment;
                    }
                    if (arg1 == null)
                    {
                        dr["ARGUMENT"] = " ";
                    }
                    else
                    {
                        dr["ARGUMENT"] = arg1;
                    }

                    if (stpexecute.ToLower() == "y")
                    {
                        logg.CreateCustomLog(_epath, "Performing Keyword:=====>" + comment + "====================================");
                        switch (keyWord.ToLower())
                        {
                            #region Generic keywords
                            #region launchapplication
                            case "launchapplication":
                                {
                                    string repeat = new string('=', 50);
                                    logg.CreateCustomLog(_epath, repeat + " Launching Application " + arg1 + DateTime.Now.ToString() + repeat);
                                    try
                                    {

                                        if (stepFrom == "0")
                                        {

                                            if (GetOSArchitecture() == "32")
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 32 bit OS ");
                                                arg1 = arg1.Replace("Program Files (x86)", "Program Files");
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }
                                            else
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 64 bit OS ");
                                                if (arg1.Contains("x86") == false)
                                                {
                                                    arg1 = arg1.Replace("Program Files", "Program Files (x86)");
                                                }
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }

                                            //we are using realtive path wrt test folder for launch
                                            if (arg1.Contains("\\") == false)
                                            {
                                                arg1 = Path.Combine(ConfigurationManager.AppSettings["testinputdata"], arg1);
                                            }
                                            #region OriginalLaunch
                                            if (File.Exists(arg1) == false)
                                            {
                                                Console.WriteLine("The Argument passed from excel script -arg1" + arg1 + "Does not exist..Please verifty if paths and configurations are correct");
                                                return false;
                                            }
                                            System.Diagnostics.Process p = new System.Diagnostics.Process();
                                            p.StartInfo.FileName = arg1;
                                            Console.WriteLine("Argument is " + arg1);
                                            p.Start();
                                            int processId = p.Id;
                                            uiautomation._processId = processId;
                                            while (!p.MainWindowTitle.Contains(arg3))
                                            {
                                                Console.WriteLine("Window Title----> {0}", p.MainWindowTitle);
                                                Thread.Sleep(10);
                                                p.Refresh();

                                            }
                                            Console.WriteLine("End Window Title {0}", p.MainWindowTitle);
                                            #endregion OriginalLaunch



                                            int lastbackslashpos = arg1.LastIndexOf("\\") + 1;
                                            System.Console.WriteLine("lastbackslashpos: " + lastbackslashpos);
                                            int arg1Len = arg1.Length;
                                            System.Console.WriteLine("arg1 Length: " + arg1Len);
                                            int diff = arg1.Length - lastbackslashpos;
                                            System.Console.WriteLine("diff Length: " + diff);
                                            arg1 = arg1.Substring(lastbackslashpos, diff);
                                            if (arg1.Contains(".exe") == true)
                                            {
                                                arg1 = arg1.Replace(".exe", "");
                                            }

                                            System.Console.WriteLine("Exe or Process name to attach is: " + arg1);
                                            if (arg2 == null || arg2 == "") //use Process name from arg1 itself no need to supply from excel
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg1); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }
                                            else //read arg2 from Script File 
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }



                                        }
                                        else if (stepFrom == "1")
                                        {
                                            //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                            //uiautomation._application = app;
                                            //wpfaction._application = app;

                                        }
                                        else
                                        {
                                            logg.CreateCustomLog(_epath, "[Wraper]:Invalid stepfrom value");
                                        }
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        repeat = new string('=', 50);
                                        logg.CreateCustomLog(_epath, repeat + " Application Launched " + DateTime.Now.ToString() + repeat);
                                        pascount++;

                                    }

                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in Keyword Launch:" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated " + ex.Message;
                                        logg.CreateCustomLog(_epath, repeat + " Failed to Launch Application" + DateTime.Now.ToString() + repeat);
                                        failcount++;
                                    }


                                    break;
                                }
                            #endregion
                            #region launchindirect
                            case "launchindirect":
                                {
                                    try
                                    {

                                        if (stepFrom == "0")
                                        {

                                            if (GetOSArchitecture() == "32")
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 32 bit OS ");
                                                arg1 = arg1.Replace("Program Files (x86)", "Program Files");
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }
                                            else
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 64 bit OS ");
                                                if (arg1.Contains("x86") == false)
                                                {
                                                    arg1 = arg1.Replace("Program Files", "Program Files (x86)");
                                                }
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }



                                            #region New Launch
                                            System.Diagnostics.Process p = new System.Diagnostics.Process();
                                            p.StartInfo.FileName = arg1;

                                            p.Start();

                                            Process[] myprocess = Process.GetProcessesByName(arg2);

                                            while (myprocess.Length == 0)
                                            {
                                                logg.CreateCustomLog(_epath, "Launching Main Process ");
                                                myprocess = Process.GetProcessesByName(arg2);
                                                Thread.Sleep(1000);

                                            }
                                            logg.CreateCustomLog(_epath, "Launched: " + myprocess[0].ProcessName);
                                            Process actualProcess = myprocess[0];

                                            while (!actualProcess.MainWindowTitle.Contains(arg3))
                                            {
                                                Console.WriteLine("Window Title----> {0}", actualProcess.MainWindowTitle);
                                                Thread.Sleep(10);
                                                actualProcess.Refresh();

                                            }
                                            Console.WriteLine("End Window Title {0}", actualProcess.MainWindowTitle);
                                            uiautomation._processId = actualProcess.Id;
                                            #endregion



                                            int lastbackslashpos = arg1.LastIndexOf("\\") + 1;
                                            System.Console.WriteLine("lastbackslashpos: " + lastbackslashpos);
                                            int arg1Len = arg1.Length;
                                            System.Console.WriteLine("arg1 Length: " + arg1Len);
                                            int diff = arg1.Length - lastbackslashpos;
                                            System.Console.WriteLine("diff Length: " + diff);
                                            arg1 = arg1.Substring(lastbackslashpos, diff);
                                            if (arg1.Contains(".exe") == true)
                                            {
                                                arg1 = arg1.Replace(".exe", "");
                                            }

                                            System.Console.WriteLine("Exe or Process name to attach is: " + arg1);
                                            if (arg2 == null || arg2 == "") //use Process name from arg1 itself no need to supply from excel
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg1); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }
                                            else //read arg2 from Script File 
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }



                                        }
                                        else if (stepFrom == "1")
                                        {
                                            //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                            //uiautomation._application = app;
                                            //uiautomation._processId = app.Process.Id;
                                            //wpfaction._application = app;

                                        }
                                        else
                                        {
                                            logg.CreateCustomLog(_epath, "[Wraper]:Invalid stepfrom value");
                                        }
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }

                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in Keyword Launchindirect:" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated " + ex.Message;
                                    }
                                    break;
                                }
                            #endregion
                            #region closewindow
                            case "closewindow":
                                {
                                    try
                                    {
                                        Thread.Sleep(2000);
                                        SendKeys.SendWait("{ENTER}");
                                        SendKeys.SendWait("{ENTER}");
                                        SendKeys.SendWait("%{F4}");
                                        SendKeys.SendWait("{ENTER}");
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function CloseWindow" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region inputformdata
                            case "inputformdata":
                                {
                                    string repeat = new string('=', 50);
                                    logg.CreateCustomLog(_epath, "Strpath value is :" + _strPath);
                                    logg.CreateCustomLog(_epath, repeat + " Adding Data from Excel Path:=" + _strPath + arg1 + " for test case " + arg2 + DateTime.Now.ToString() + repeat);
                                    try
                                    {
                                        uiautomation.AddData(_strPath + arg1, arg2);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        failcount++;
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function inputformdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();


                                    }
                                    break;
                                }
                            #endregion
                            #region comapredoc
                            case "comparedoc":
                                {
                                    try
                                    {
                                        TestDataManagement testData = new Helper.TestDataManagement();

                                        testData.GetTestData(_strPath + arg1, "T1");
                                        DataTable expectedData = testData.Data;
                                        int tableNumber = int.Parse(arg3);
                                        //DataTable actualData = verifyReport(_strPath + arg2, tableNumber);
                                        //DataTable ResultTable = CompareData(expectedData, actualData);
                                        //Helper.ReportsManagement rppt1 = new Helper.ReportsManagement();
                                        //rppt1.ResultTable = ResultTable;
                                        //rppt1.ReportPath = arg5;
                                        //rppt1.GenerateReport(_strPath + arg4);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function inputformdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region verifyfileexistence
                            case "verifyfileexistence":
                                {
                                    try
                                    {
                                        string expectedData = _strPath + arg1;
                                        DataTable ResultTable = verifyFileExistence(expectedData);
                                        Helper.ReportsManagement rppt1 = new Helper.ReportsManagement();
                                        rppt1.ResultTable = ResultTable;
                                        rppt1.ReportPath = arg5;
                                        rppt1.GenerateReport(_strPath + arg4);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function inputformdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region closewindowwithtitle
                            case "closewindowwithtitle":
                                {
                                    try
                                    {
                                        //uiautomation._globalWindow = wpfaction.GetWPFWindow(arg1);
                                        uiautomation.closeGlobalWindow();
                                        Thread.Sleep(2000);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in closewindowwithtitle" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region resetuiwindow
                            case "resetuiwindow":
                                {
                                    try
                                    {
                                        uiautomation.uiAutomationWindow = null;
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in resetuiwindow" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifydatatable
                            case "verifydatatable":
                                {
                                    try
                                    {
                                        uiautomation.VerifyData(_strPath + arg1, arg2);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifydatatable" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;


                                }
                            #endregion
                            #region verifyformdata
                            case "verifyformdata":
                                {
                                    try
                                    {
                                        _finalReports = arg5;
                                        string repeat = new string('=', 50);
                                        logg.CreateCustomLog(_epath, arg1);
                                        logg.CreateCustomLog(_epath, arg2);
                                        logg.CreateCustomLog(_epath, arg3);
                                        logg.CreateCustomLog(_epath, arg4);
                                        logg.CreateCustomLog(_epath, arg5);
                                        logg.CreateCustomLog(_epath, "1-5 arguments");
                                        logg.CreateCustomLog(_epath, repeat + "Verifying Data from Excel " + arg1 + "for test case " + arg2 + DateTime.Now.ToString() + repeat);
                                        uiautomation.verifyDataForm(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifydatatable" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region compareXML
                            case "comparexml":
                                {
                                    try
                                    {
                                        _finalReports = arg4;
                                        arg3 = ConfigurationManager.AppSettings["testinputdata"] + arg3;  //arr[0];
                                        logg.CreateCustomLog(_epath, "Path used for comparexml keyword" + arg1);

                                        if (arg1.Trim().Length == 0 || arg2.Trim().Length == 0 || arg3.Trim().Length == 0 || arg4.Trim().Length == 0)
                                            logg.CreateCustomLog(_epath, "Need values for arg1,arg2,arg3 and arg4");
                                        else
                                        {

                                            CompareXML(arg1, arg2, arg3, arg4, logg, _epath);
                                            stopwatch3.Stop();
                                            dr["RESULT"] = "Success";
                                            dr["MESSAGE"] = "Completed";
                                            dr["TimeTaken"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  comparexml " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifydataiepanetable
                            case "verifydataiepanetable":
                                {
                                    try
                                    {
                                        uiautomation.verifyDataIEPaneTable(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "verifydataiepanetable" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region manualintervention
                            case "manualintervention":
                                {
                                    try
                                    {
                                        fn_BalloonToolTip(arg1, arg2);
                                        Console.WriteLine("Please Press Enter to proceed to next step");
                                        Console.ReadLine();
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in manualintervention" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifywpfdatagrid
                            case "verifywpfdatagrid":
                                {
                                    try
                                    {
                                        uiautomation.VerifyDataGridContent(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifywpfdatagrid" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifydatagrid

                            case "verifydatagrid":
                                {
                                    try
                                    {
                                        uiautomation.VerifyDataGrid2Content(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifydatagrid" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;

                                }
                            #endregion
                            #region verify_plotdata
                            case "verify_plotdata":
                                {
                                    try
                                    {
                                        verify_plotdata(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verify_plotdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region infraselectrows

                            case "infraselectrows":
                                {
                                    try
                                    {
                                        selectspecfedrows(Int32.Parse(arg1), Int32.Parse(arg2));
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in infraselectrows" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;

                                }
                            #endregion
                            #region clickbuttonwindowtitle
                            case "clickbuttonwindowtitle":
                                {
                                    try
                                    {
                                        wellflocomui.GetAppWindow(arg1);
                                        wellflocomui.ClickButton(arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in clickbuttonwindowtitle" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region clickbuttonwindowautoid
                            case "clickbuttonwindowautoid":
                                {
                                    try
                                    {
                                        //SearchCriteria search = SearchCriteria.ByAutomationId(arg1);
                                        //Window wnd = wpfaction._application.GetWindow(search, White.Core.Factory.InitializeOption.NoCache);
                                        //var btn = wnd.Get<White.Core.UIItems.Button>(arg2);
                                        //btn.Click();
                                        //dr["RESULT"] = "Success";
                                        //dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        //pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in clickbuttonwindowautoid" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region clickbuttonchildwindowtitle
                            case "clickbuttonchildwindowtitle":
                                {
                                    try
                                    {
                                        specialApply(arg1, arg2, arg3);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in clickbuttonchildwindowtitle" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region clickcordinates
                            case "clickcordinates":
                                {
                                    try
                                    {
                                        string repeat = new string('=', 50);
                                        logg.CreateCustomLog(_epath, repeat + " Clicking coordinates " + arg1 + ";" + arg2 + DateTime.Now.ToString() + repeat);
                                        AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3();
                                        int x1 = Convert.ToInt32(arg1);
                                        int y1 = Convert.ToInt32(arg2);
                                        at1.MouseClick("LEFT", x1, y1, 1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickcordinates" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region createoutputimage
                            case "createoutputimage":
                                {
                                    try
                                    {
                                        createOutputImage(arg1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  createoutputimage" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region clickcordinatesdbl
                            case "clickcordinatesdbl":
                                {
                                    try
                                    {
                                        AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3();
                                        int x1 = Convert.ToInt32(arg1);
                                        int y1 = Convert.ToInt32(arg2);
                                        at1.MouseClick("LEFT", x1, y1, 2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickcordinates" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region rightclick
                            case "rightclick":
                                {
                                    try
                                    {
                                        AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3();
                                        int x1 = Convert.ToInt32(arg1);
                                        int y1 = Convert.ToInt32(arg2);
                                        at1.MouseClick("RIGHT", x1, y1, 1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  rightclick" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region wait
                            case "wait":
                                {
                                    try
                                    {
                                        logg.CreateCustomLog(_epath, "Performing Keyword:===== Wait ====================================");
                                        Console.WriteLine("Waiting in Driver script for " + arg1 + "seconds");
                                        Thread.Sleep(Int32.Parse(arg1) * 1000);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  wait" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region updatestructure
                            case "updatestructure":
                                {
                                    try
                                    {
                                        UpdateStructure(arg1, arg2, arg3, arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  updatestructure" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region setexpectednactualdata
                            case "setexpectednactualdata":
                                {
                                    try
                                    {
                                        testdataobj.ActualData.Clear();
                                        testdataobj.ExpectedData.Clear();
                                        testdataobj.GetTestData(arg1, arg2);
                                        testdataobj.ActualData = testdataobj.Data;
                                        testdataobj.ExpectedData = testdataobj.GetVerificationData(arg3, arg4);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  setexpectednactualdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region comparecsv
                            case "comparecsv":
                                {
                                    try
                                    {
                                        testdataobj.CompareData();
                                        logg.CreateCustomLog(_epath, "Compare Data Finished");
                                        rpt.ResultTable = testdataobj.ResultTable;
                                        rpt.ReportPath = arg2;
                                        logg.CreateCustomLog(_epath, "Trying to create Report");
                                        rpt.GenerateReport(_strPath + arg1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  comparecsv" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }


                                    break;
                                }
                            #endregion
                            #region upadtereportersheet
                            case "upadtereportersheet":
                                {
                                    try
                                    {
                                        testdataobj.UpdateReporterSheet(_strPath + arg1, "testcase", arg2);
                                        testdataobj.UpdateReporterSheet(_strPath + arg1, "section", arg3);
                                        testdataobj.UpdateReporterSheet(_strPath + arg1, "webtable", arg4);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  upadtereportersheet" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region copydata
                            case "copydata":
                                {
                                    try
                                    {
                                        Excel.Application xlApp = new Excel.Application();
                                        Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(_strPath + arg1);
                                        Excel._Worksheet xlWorksheet = (Excel._Worksheet)xlWorkbook.Sheets[1];
                                        Excel.Range xlRange = xlWorksheet.UsedRange;
                                        xlRange.Copy(System.Type.Missing);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  CopyData" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifywordfile
                            case "verifywordfile":
                                {
                                    try
                                    {
                                        worddocverification(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  verifywordfile " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;

                                }

                            #endregion
                            #region writeingrid
                            case "writeingrid":
                                {
                                    try
                                    {
                                        writeGridContent(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  writeingrid " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region Compare Excel
                            case "compareexcel":
                                {
                                    try
                                    {
                                        CompareExcel(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  writeingrid " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }

                            #endregion

                            #region Lowis related keywords
                            #region deletefile
                            case "deletefile":
                                {
                                    try
                                    {


                                        DeleteFile(arg1, logg, _epath);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  DeleteFile " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region deletefiles
                            case "deletefiles":
                                {
                                    try
                                    {
                                        testdataobj.GetTestData(_deleteFilesPath, "");

                                        DataTable dtDelete = testdataobj.Data;
                                        for (int row = 0; i < dtDelete.Rows.Count; row++)
                                        {
                                            DeleteFile((string)dtDelete.Rows[row][0], logg, _epath);
                                        }
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  DeleteFiles " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region searchgridrow
                            case "searchgridrow":
                                {
                                    try
                                    {
                                        SearchGridRow(arg1, arg2, arg3, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {


                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  searchgridrow " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region addrowtodatagrid
                            case "addrowtodatagrid":
                                {
                                    try
                                    {
                                        AddRowToDataGrid(arg1, arg2, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {


                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  addrowtodatagrid " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region clickmenus
                            case "clickmenus":
                                {
                                    try
                                    {
                                        ClickMenus(arg1, arg2, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed";
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {


                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickmenus " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region clickmenus
                            case "clickbeamdesign":
                                {
                                    try
                                    {
                                        ClickBeamDesign(arg1, arg2, arg3, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed";
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();


                                    }
                                    catch (Exception ex)
                                    {

                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickbeamdesign " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region cleanupcstore
                            case "cleanupcstore":
                                {
                                    try
                                    {
                                        cleanupcstore(arg1);

                                        dr["RESULT"] = "Success";
                                        dr["Message"] = "Completed";
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  cleanupcstore " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    break;
                                }

                            #endregion
                            #region menuiteam
                            case "menuiteam":
                                {
                                    try
                                    {
                                        menuiteam(arg1);

                                        dr["RESULT"] = "Sucess";
                                        dr["Message"] = "Completed";
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in menuiteam" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region standardpump
                            case "standardpump":
                                {
                                    try
                                    {
                                        standardpump(arg1, arg2, arg3);

                                        dr["RESULT"] = "Sucess";
                                        dr["Message"] = "Completed";
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in standardpumpsave" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #endregion

                            default:
                                returndriveFromExcel = false;
                                throw new Exception("Not a valid Keyword");
                        }
                        dtResultSummary.Rows.Add(dr);
                        sNo = sNo + 1;
                    }
                    else
                    {
                        // logg.CreateCustomLog(_epath, "[Wraper]:Not Executing the Keyword: -> " + keyWord);
                    }

                    if (returndriveFromExcel == false)
                    {
                        logg.CreateCustomLog(_epath, "*********************ScriptTermination ********************************");
                        logg.CreateCustomLog(_epath, "Script: " + excelfilePath + "was terminited due to above errors and host or application was also terminated");
                        break;
                    }

                }
                GenerateReport(_resultsSummaryFile, dtResultSummary);

                if (File.Exists(_resultsFile) == false)
                {
                    Console.WriteLine("Result File does not exist:  " + _resultsFile);
                }
                else
                {
                    DataTable dtResults = GetResultsData(_resultsFile, "");
                    DataRow[] success = dtResults.Select("Result= 'Pass'");
                    DataRow[] failed = dtResults.Select("Result='Fail'");


                    Console.WriteLine("Finished Test (Errors:" + failed.Length.ToString() + "," + " Warnings:" + failcount + ")");
                }
                return returndriveFromExcel;
            }
            catch (Exception ex)

            {
                Console.WriteLine("Generic Error has occurred " + ex.Message);
                return false;
            }

        }
Example #5
0
        private static void ClickControl(AutomationElement control)
        {

            try
            {
                AutoItX3Lib.AutoItX3 at = new AutoItX3Lib.AutoItX3();

                System.Windows.Point clickpoint1 = control.GetClickablePoint();
                Console.WriteLine("Got clickable Points ");
                double x = clickpoint1.X;
                double y = clickpoint1.Y;
                int x1 = Convert.ToInt32(x);
                int y1 = Convert.ToInt32(y);

                at.MouseMove(x1, y1, -1);
                try
                {
                    at.MouseClick("LEFT", x1, y1, 1);

                }
                catch (Exception e)
                {
                    throw new Exception(e.Message);
                }

            }
            catch (Exception ex)
            {

                throw new Exception("error on getclickablepoints :" + ex.Message);

            }
        }
Example #6
0
 static Au3()
 {
     au3 = new AutoItX3Lib.AutoItX3();
 }
 static Au3()
 {
     au3 = new AutoItX3Lib.AutoItX3();
     LastWindow = "";
 }
        private void AddData(int rowPosition)
        {
            string parentType = "";
            string parentSearchBy = "";
            string parentSearchValue = "";
            string controlaction = "";
            string section = "";
            var _controlType = "";
            var _logicalName = "";
            var _controlName1 = "{Right}";
            try
            {
                #region recordsinexcel
                string _controlValue = null;
                section = testData.Structure.Rows[0]["Section"].ToString();
                // When to Create Data table for first time ?
                //   if (System.IO.File.Exists(_reportsPath + uiAfileName + "Log.csv") == false)
                //   {
                //    uilog.AddHeaders();
                //   }
                for (int i = 0; i < testData.Structure.Rows.Count; i++)
                {
                    uilog.AddHeaders();
                    uilog.createnewrow();
                    parentType = testData.Structure.Rows[i]["ParentType"].ToString();
                    parentSearchBy = testData.Structure.Rows[i]["ParentSearchBy"].ToString().ToLower();
                    parentSearchValue = testData.Structure.Rows[i]["ParentSearchValue"].ToString();
                    controlaction = testData.Structure.Rows[i]["ParentSearchValue"].ToString();
                    uilog.AddTexttoColumn("FunctionName", "AddData");
                    uilog.AddTexttoColumn("StructureSheetName", ptestDataPath);
                    uilog.AddTexttoColumn("TestCaseID", ptestCase);
                    uilog.AddTexttoColumn("ParentType", parentType);
                    uilog.AddTexttoColumn("ParentSearchBy", parentSearchBy);
                    uilog.AddTexttoColumn("ParentSearchValue", parentSearchValue);

                    if (Convert.IsDBNull(testData.Structure.Rows[i]["FieldName"]) == false)
                    {
                        _logicalName = (string)testData.Structure.Rows[i]["FieldName"].ToString();
                        logTofile(_eLogPtah, "Read  FieldName/Logical Name : " + _logicalName);
                        uilog.AddTexttoColumn("FieldName", _logicalName);
                    }
                    if (_logicalName.Length > 0)
                    {
                        _controlValue = (string)testData.Data.Rows[0][_logicalName].ToString();
                        logTofile(_eLogPtah, "Logical Name: " + _logicalName + " Input Value :  " + _controlValue);
                        uilog.AddTexttoColumn("ControlValue", _controlValue);
                    }

                    logTofile(_eLogPtah, "******************* Section (Screen Name ) : " + section + "*************************************");

                    if ((string)testData.Structure.Rows[i]["inputdata"].ToString().ToLower() == "y")
                    {

                        if (Convert.IsDBNull(testData.Structure.Rows[i]["ParentType"]) == false)
                        {
                            if (!String.IsNullOrEmpty(_controlValue) || String.IsNullOrEmpty(_controlType))
                            {

                                #region ConstructParent
                                switch (parentType.Trim().ToLower())
                                {
                                    case "window":
                                        {
                                            try
                                            {
                                                /* wpfapp._application = _application;
                                                 _globalWindow = wpfapp.GetWPFWindow(parentSearchValue);
                                                 _globalWindow.Click();
                                                 * */
                                            }
                                            catch (Exception ex)
                                            {
                                                logTofile(_eLogPtah, "[AddData]->[Window]: Execption was encountered" + ex.Message.ToString());
                                            }
                                            break;
                                        }
                                    /*  case "groupbox":
                                          {
                                              if (_immediateParent.Trim().ToLower() == "window")
                                                  wpfapp.GetWPFGroupBox(_globalWindow, parentSearchBy, parentSearchValue);
                                              else
                                                  wpfapp.GetWPFGroupBox(_globalGroup, parentSearchBy, parentSearchValue);
                                              break;
                                          }
                                      case "wpfmenu":
                                          {
                                              _globalMenu = wpfapp.GetWPFMenu(_globalWindow, parentSearchBy, parentSearchValue);
                                              _globalMenu.Click();
                                              break;
                                          } */
                                    case "uiautomationwindow":
                                    case "uwindow":
                                        {

                                            //  if (uiAutomationWindow == null || uiAutomationWindow.Current.Name != parentSearchValue)

                                            if (uiAutomationWindow == null)
                                            {
                                                uiAutomationWindow = GetUIAutomationWindow(parentSearchBy, parentSearchValue);

                                            }
                                            else
                                            {
                                                uiAutomationCurrentParent = uiAutomationWindow;
                                                logTofile(_eLogPtah, "[AddData]->[uiautomationwindow]->UI automationwindow was already set " + uiAutomationWindow.Current.Name.ToString());
                                            }
                                            break;

                                        }

                                    case "uiautomationchildwindow":
                                    case "uchildwindow":
                                        {

                                            uiAutomationCurrentParent = GetUIAutomationWindow(parentSearchBy, parentSearchValue);
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationchildwindow]->UI automationchild window was already set " + uiAutomationCurrentParent.Current.Name.ToString());

                                            break;

                                        }
                                    //  case "uiautomationpane":
                                    //    {
                                    //        uiAutomationCurrentParent = GetUIAutomationPane(parentSearchBy, parentSearchValue);
                                    //        break;
                                    //    }
                                    case "commonhieararchy":
                                        {
                                            string parentH = "";
                                            string parentHvalue = "";
                                            string parentHSearchby = "";
                                            testDataHieararchy.GetTestData(hrchyfile, parentSearchValue);
                                            # region HiearachySheet
                                            for (int ih = 0; ih < testDataHieararchy.Data.Rows.Count; ih++)
                                            {
                                                parentH = testDataHieararchy.Data.Rows[ih]["Parent"].ToString();
                                                parentHvalue = testDataHieararchy.Data.Rows[ih]["Value"].ToString();
                                                parentHSearchby = testDataHieararchy.Data.Rows[ih]["HSearchBy"].ToString();
                                                switch (parentH.ToString().ToLower())
                                                {
                                                    case "uiautomationwindow":
                                                        {
                                                            if (uiAutomationWindow == null)
                                                            {
                                                                uiAutomationWindow = GetUIAutomationWindow(parentHSearchby, parentHvalue);
                                                            }
                                                            else
                                                            {

                                                                uiAutomationCurrentParent = uiAutomationWindow;
                                                                logTofile(_eLogPtah, "[AddData]->[commonhieararchy]->[uiautomationwindow] : loaded with UIautomaiton window Value");
                                                                logTofile(_eLogPtah, "[AddData]->[commonhieararchy]->[uiautomationwindow] :UI automationwindow was already set and hehce Will not be Reloaded unless you force by some means:COMMONH");
                                                            }
                                                            break;
                                                        }
                                                    case "uiautomationpane":
                                                        {
                                                            GetDescenDentPaneWithName(parentHvalue);
                                                            break;
                                                        }
                                                    // this is used to junp to nth pane when no automation id or text was avaialable for panes.
                                                    case "uiautomationchildpane":
                                                        {
                                                            GetChildPane(Int32.Parse(parentHvalue));
                                                            break;
                                                        }
                                                }
                                            }
                                            # endregion HiearachySheet
                                            break;
                                        }
                                    case "uiautomationpane":
                                    case "upane":
                                        {
                                            if (_controlValue.Length > 0)
                                            {
                                                GetDescenDentPaneWithName(parentSearchValue);
                                            }
                                            break;
                                        }
                                    case "uiautomationchildpane":
                                    case "uchildpane":
                                        {
                                            GetChildPane(Int32.Parse(parentSearchValue));
                                            break;
                                        }

                                    case "uiautomationtreeitem":
                                    case "utreeitem":
                                        {
                                            uiAutomationCurrentParent = GetUIAutomationtreeitem(parentSearchBy, parentSearchValue, -1);
                                            break;
                                        }

                                    default:
                                        throw new Exception("[AddData]:Not a valid parent type.");
                                }
                                #endregion ConstructParent
                            }
                            else
                            {
                                logTofile(_eLogPtah, "Parent is not constructed as control value is null");
                            }
                        }

                        var _action = "";
                        var _searchBy = "";
                        var _index = -1;
                        var _controlName = "";
                        if (Convert.IsDBNull(testData.Structure.Rows[i]["ControlName"]) == false)
                        {
                            _controlName = (string)testData.Structure.Rows[i]["ControlName"];
                            uilog.AddTexttoColumn("ControlName", _controlName);
                        }
                        logTofile(_eLogPtah, "SearchValue of control has been read from datatable " + _controlName);
                        try
                        {
                            if (Convert.IsDBNull(testData.Structure.Rows[i]["FrenchValue"]) == false)
                            {
                                _controlName1 = (string)testData.Structure.Rows[i]["FrenchValue"].ToString();
                                logTofile(_eLogPtah, "Read  FrenchValue : " + _controlName1);
                            }
                        }
                        catch
                        {
                        }

                        if (Convert.IsDBNull(testData.Structure.Rows[i]["Action"]) == false)
                        {
                            _action = (string)testData.Structure.Rows[i]["Action"];
                            logTofile(_eLogPtah, "Action:" + _action);
                            uilog.AddTexttoColumn("Action", _action);
                            #region ActionColumn
                            switch (_action.Trim().ToLower())
                            {
                                case "drag":
                                    logTofile(_eLogPtah, "[Using drag action] ");
                                    string[] coord = _controlValue.Split(';');
                                    string startCoordinate = coord[0];
                                    string endCoordinate = coord[1];
                                    clsCUIT_app app = new clsCUIT_app();
                                    app._eLogPtah = _eLogPtah;
                                    app.Drag(startCoordinate, endCoordinate);
                                    uilog.AddTexttoColumn("Action Performed on Control", "Drag:");
                                    break;

                                case "autoitdrag":
                                    logTofile(_eLogPtah, "[Using autoit drag action]");
                                    string[] coordinates = _controlValue.Split(';');
                                    string startcoord = coordinates[0];
                                    string endcoord = coordinates[1];
                                    string[] start = startcoord.Split(',');
                                    string[] end = endcoord.Split(',');
                                    int x1 = Convert.ToInt32(start[0]);
                                    int y1 = Convert.ToInt32(start[1]);
                                    int x2 = Convert.ToInt32(end[0]);
                                    int y2 = Convert.ToInt32(end[1]);
                                    at.MouseClickDrag("Left", x1, y1, x2, y2, 10);
                                    uilog.AddTexttoColumn("Action Performed on Control", "AutoIt Drag");
                                    break;

                                case "keyboard":
                                    logTofile(_eLogPtah, "[Using Keyboard searching] " + _controlName);

                                    System.Windows.Forms.SendKeys.Flush();
                                    logTofile(_eLogPtah, "Waiting for : " + _controlName);
                                    System.Windows.Forms.SendKeys.SendWait(_controlName);
                                    uilog.AddTexttoColumn("Action Performed on Control", "Sent Keystroke: Unconditional" + _controlName);
                                    break;

                                case "condkeyboard":
                                    logTofile(_eLogPtah, "[Checking if Conditional Keyboard is to be used]");
                                    if (_controlValue.Length > 0)
                                    {
                                        logTofile(_eLogPtah, "[Using Conditional Keyboard] " + _controlName);
                                        if (Convert.IsDBNull(testData.Structure.Rows[i]["Index"]) == false)
                                        {
                                            _index = Convert.ToInt32(testData.Structure.Rows[i]["Index"]);
                                            logTofile(_eLogPtah, " value of index " + _index);
                                            for (int j = 0; j < _index; j++)
                                            {
                                                System.Windows.Forms.SendKeys.Flush();
                                                Console.WriteLine("Waiting for : " + _controlName);
                                                System.Windows.Forms.SendKeys.SendWait(_controlName);
                                                uilog.AddTexttoColumn("Action Performed on Control", "Sent Keystroke: conditional using index value" + _controlName);
                                            }
                                        }
                                        else
                                        {
                                            System.Windows.Forms.SendKeys.Flush();
                                            Console.WriteLine("Waiting for : " + _controlName);
                                            System.Windows.Forms.SendKeys.SendWait(_controlName);
                                            uilog.AddTexttoColumn("Action Performed on Control", "Sent Keystroke: conditional not using index value" + _controlName);
                                        }

                                    }
                                    break;

                                case "wait":
                                    logTofile(_eLogPtah, "[Waiting for ] " + _controlName);
                                    Console.WriteLine("Waiting for : " + _controlName);
                                    Thread.Sleep(int.Parse(_controlName) * 1000);
                                    uilog.AddTexttoColumn("Action Performed on Control", "Wait for " + _controlName + "Seconds");
                                    break;

                                case "conditionalwait":
                                    logTofile(_eLogPtah, "[Checking if Conditional wait is to be used]");
                                    if (_controlValue.Length > 0)
                                    {
                                        logTofile(_eLogPtah, "[Using Conditional wait] " + _controlName);
                                        Console.WriteLine("Waiting for : " + _controlName);
                                        Thread.Sleep(int.Parse(_controlName) * 1000);
                                        uilog.AddTexttoColumn("Action Performed on Control", "Wait for " + _controlName + "Seconds");

                                    }
                                    break;
                                /*  case "pagedown":
                                      Console.WriteLine("pagedown");
                                      _globalWindow.Focus();
                                      Thread.Sleep(1000);
                                      _globalWindow.Keyboard.PressSpecialKey(White.Core.WindowsAPI.KeyboardInput.SpecialKeys.PAGEDOWN);
                                      uilog.AddTexttoColumn("Action Performed on Control", "Pagedown");
                                      break; */

                                /*  case "pageup":
                                      _globalWindow.Focus();
                                      _globalWindow.Keyboard.PressSpecialKey(White.Core.WindowsAPI.KeyboardInput.SpecialKeys.PAGEUP);
                                      break; */
                                case "refresh":
                                    break;
                                case "clearwindow":
                                    // When we switch to a new UI automation window we must use "clear windo" in new structure sheet new window
                                    uiAutomationWindow = null;
                                    uilog.AddTexttoColumn("Action Performed on Control", "clearwindow");
                                    break;
                                default:
                                    logTofile(_eLogPtah, "[AddData]:Other Action than Specified Action: ---> " + _action.Trim().ToLower());
                                    throw new Exception("Valid action types are keyboard, wait, pagedown, pageup");
                            }
                            #endregion ActionColumn
                        }
                        if (Convert.IsDBNull(testData.Structure.Rows[i]["ControlType"]) == false)
                        {
                            _controlType = (string)testData.Structure.Rows[i]["ControlType"].ToString().ToLower();
                            //    _logicalName = (string)testData.Structure.Rows[i]["FieldName"].ToString();
                            _searchBy = (string)testData.Structure.Rows[i]["SearchBy"];
                            Console.WriteLine(_logicalName);
                            logTofile(_eLogPtah, "Field Name : =" + _logicalName);
                            if (Convert.IsDBNull(testData.Structure.Rows[i]["Index"]) == false)
                            {
                                logTofile(_eLogPtah, "Trying to parse index for : " + _logicalName);
                                _index = int.Parse(testData.Structure.Rows[i]["Index"].ToString());
                                logTofile(_eLogPtah, "Index was parsed. : " + _logicalName);
                            }

                            if (_logicalName.Length > 0)
                            {
                                _controlValue = (string)testData.Data.Rows[rowPosition][_logicalName].ToString();
                            }
                            if (_logicalName.Length > 0 && _controlValue.Length == 0)
                            {
                                logTofile(_eLogPtah, "controlValue Length : " + _controlValue.Length);
                                logTofile(_eLogPtah, "both Logical name was of 0 lenght and  Control valuewas of 0 lenght :nothing doing !!!" + _logicalName);
                            }
                            else
                            {
                                #region ControlTypes
                                uilog.AddTexttoColumn("ControlType", _controlType);
                                switch (_controlType.Trim().ToLower())
                                {

                                    /* case "wpfmenuitem":
                                         wpfapp.GetWPFMenuItem(_globalMenu, _controlName).Click();
                                         break;

                                     case "wpftoolstrip":
                                         wpfapp.GetWPFToolStrip(_globalWindow, _controlName).Focus();
                                         break;

                                     case "wpflistbox":
                                         wpfapp.GetWPFListBox(_globalWindow, _searchBy, _controlName).Focus();
                                         wpfapp.GetWPFListBox(_globalWindow, _searchBy, _controlName).Item(_controlValue).Select();
                                         break;

                                     case "wpflabel":
                                         string labelName = wpfapp.GetWPFLabel(_globalWindow, _searchBy, _controlName).Text.ToString();
                                         testData.UpdateTestData(testData.TestDataFile, testData.TestCase, _logicalName, labelName);
                                         break; */

                                    case "uiautomationmenu":
                                    case "umenu":
                                        {
                                            if (_controlValue.Length > 0)
                                            {

                                                AutomationElement umenu = GetUIAutomationMenu(_searchBy, _controlName, _index);
                                                logTofile(_eLogPtah, "returned menu :" + umenu.Current.Name);
                                                ClickControl(umenu);
                                                Thread.Sleep(2000);
                                            }
                                            break;

                                        }
                                    case "uiautomationmenuitem":
                                    case "umenuitem":
                                        {
                                            if (_controlValue.Length > 0)
                                            {
                                                AutomationElement umenuitem = GetUIAutomationMenuItem(_searchBy, _controlName, _index);
                                                try
                                                {
                                                    ClickControl(umenuitem);
                                                }
                                                catch (Exception ex)
                                                {
                                                    logTofile(_eLogPtah, "Execption from click control was " + ex.Message.ToString());
                                                    logTofile(_eLogPtah, "Using Invoke Pattern for Menuitem alternately ");
                                                    InvokePattern invkptn = (InvokePattern)umenuitem.GetCurrentPattern(InvokePattern.Pattern);
                                                    invkptn.Invoke();
                                                }
                                            }
                                            break;
                                        }
                                    case "umenuiteminvoke":
                                        {
                                            if (_controlValue.Length > 0)
                                            {
                                                AutomationElement umenuiteminvoke = GetUIAutomationMenuItem(_searchBy, _controlName, _index);
                                                string uname = umenuiteminvoke.Current.Name.ToString();
                                                try
                                                {
                                                    InvokePattern invkbuttonptn = (InvokePattern)umenuiteminvoke.GetCurrentPattern(InvokePattern.Pattern);
                                                    logTofile(_eLogPtah, "Got the Invoke Pattern");
                                                    logTofile(_eLogPtah, "[AddData][uitem]: Menuitem will be clicked : " + _controlValue.ToString() + ":Times");
                                                    invkbuttonptn.Invoke();
                                                    System.Threading.Thread.Sleep(20);
                                                    logTofile(_eLogPtah, "[AddData][uitem]:Clicked menuitem : " + uname);

                                                    uilog.AddTexttoColumn("Action Performed on Control", "Invoke Pattern");
                                                }
                                                catch
                                                {
                                                    logTofile(_eLogPtah, "No  Invoke Pattern hence using Click Control");
                                                    ClickControl(umenuiteminvoke);
                                                    uilog.AddTexttoColumn("Action Performed on Control", "Invoke Pattern");
                                                }
                                            }
                                            break;
                                        }
                                    case "uiautomationthumb":
                                    case "uthumb":
                                        {
                                            if (_controlValue.Length > 0)
                                            {
                                                AutomationElement uthumb = GetUIAutomationThumb(_searchBy, _controlName, _index);
                                                if (uthumb != null)
                                                {
                                                    logTofile(_eLogPtah, "[Adddata]:[uiautomationthumb]:found control trying to double click it");
                                                    try
                                                    {
                                                        DoubleClickControl(uthumb);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        logTofile(_eLogPtah, "[Adddata]:[uiautomationthumb] Error--.>" + ex.Message.ToString());
                                                    }
                                                }
                                                else
                                                {
                                                    logTofile(_eLogPtah, "[Adddata]:[uiautomationthumb] thumb control Not found ");
                                                }

                                            }
                                            break;
                                        }
                                    case "uiautomationtext":
                                    case "utext":
                                        {
                                            if (_controlValue.Length > 0)
                                            {
                                                AutomationElement utext = GetUIAutomationText(_searchBy, _controlName, _index);

                                                switch (_controlValue.ToLower())
                                                {
                                                    case "1":
                                                        ClickControl(utext);
                                                        break;
                                                    case "l":
                                                        ClickControl(utext);
                                                        break;
                                                    case "r":
                                                        RightClickControl(utext);
                                                        break;
                                                    case "d":
                                                        DoubleClickControl(utext);
                                                        break;
                                                    default:
                                                        Console.WriteLine("No valid input provided for clicking text");
                                                        break;
                                                }
                                            }
                                            break;
                                        }
                                    case "uiautomationimage":
                                    case "uimage":
                                        {
                                            if (_controlValue.Length > 0)
                                            {
                                                AutomationElement uimage = GetUIAutomationImage(_searchBy, _controlName, _index);
                                                switch (_controlValue.ToLower())
                                                {
                                                    case "1":
                                                        ClickControl(uimage);
                                                        break;
                                                    case "l":
                                                        ClickControl(uimage);
                                                        break;
                                                    case "r":
                                                        RightClickControl(uimage);
                                                        break;
                                                    case "d":
                                                        DoubleClickControl(uimage);
                                                        break;
                                                    default:
                                                        Console.WriteLine("No valid input provided for clicking image");
                                                        break;
                                                }
                                            }
                                            break;

                                        }

                                    case "uiautomationdataitem":
                                    case "udataitem":
                                        {
                                            if (_controlValue.Length > 0)
                                            {
                                                logTofile(_eLogPtah, "control value : " + _controlValue);
                                                AutomationElement udtitem = GetUIAutomationDataItem(_searchBy, _controlName, _index);
                                                SelectionItemPattern selpat = (SelectionItemPattern)udtitem.GetCurrentPattern(SelectionItemPattern.Pattern);
                                                selpat.Select();
                                                switch (_controlValue.ToLower())
                                                {
                                                    case "d":
                                                        DoubleClickControl(udtitem);
                                                        break;
                                                    case "l":
                                                        ClickControl(udtitem);
                                                        break;
                                                    case "r":
                                                        RightClickControl(udtitem);
                                                        break;
                                                    case "1":
                                                        ClickControl(udtitem);
                                                        break;
                                                }
                                            }
                                        }
                                        break;

                                    case "uiautomationspinner":
                                    case "uspinner":
                                        {
                                            if (_controlValue.Length > 0)
                                            {
                                                logTofile(_eLogPtah, "control value:" + _controlValue);
                                                AutomationElement uspinner = GetUIAutomationSpinner(_searchBy, _controlName, _index);
                                                uspinner.SetFocus();

                                            }
                                        }
                                        break;
                                    /*  case "wpflistview":
                                          wpfapp.GetWPFDataGrid(_globalWindow, _searchBy, _controlName).Focus();
                                          break; */

                                    /*  case "wpfcombobox":
                                          if (_controlValue.Length > 0)
                                          {
                                              wpfapp.GetWPFComboBox(_globalWindow, _searchBy, _controlName, _index).Select(_controlValue);
                                              uilog.AddTexttoColumn("Control Detected", "Yes");
                                              uilog.AddTexttoColumn("Action Performed on Control", "select Combo item" + _controlValue);
                                          }
                                          break; */
                                    case "uiautomationcombobox":
                                    case "ucombobox":
                                        bool itemClicked = false;
                                        AutomationElement combo = GetUIAutomationComboBox(_searchBy, _controlName, _index);
                                        try
                                        {
                                            combo.SetFocus();
                                            ExpandCollapsePattern expandPat = (ExpandCollapsePattern)combo.GetCurrentPattern(ExpandCollapsePattern.Pattern);
                                            if (expandPat != null)
                                            {
                                                logTofile(_eLogPtah, "Expanding the combobox");
                                                expandPat.Expand();
                                                Thread.Sleep(100);
                                            }
                                        }
                                        catch
                                        {

                                        }
                                        //Click control was giving issue in K2, so added try catch
                                        try
                                        {
                                            ClickControl(combo);
                                        }
                                        catch
                                        {
                                        }

                                        System.Threading.Thread.Sleep(1000);

                                        //Control value is item to select
                                        AutomationElementCollection comboitems = combo.FindAll(TreeScope.Descendants,
                                            new System.Windows.Automation.PropertyCondition(AutomationElement.ControlTypeProperty, System.Windows.Automation.ControlType.ListItem));

                                        logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]:collection count was " + comboitems.Count);

                                        for (int icb = 0; icb <= comboitems.Count - 1; icb++)
                                        {

                                            if (comboitems[icb].Current.Name.ToLower() == _controlValue.ToLower()) //if listitemname matches
                                            {
                                                logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]: Search By Name " + _controlValue.ToLower());
                                                SelectionItemPattern selpat = (SelectionItemPattern)comboitems[icb].GetCurrentPattern(SelectionItemPattern.Pattern);
                                                logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]:match found for -->" + _controlValue.ToLower());
                                                selpat.Select();
                                                uilog.AddTexttoColumn("Action Performed on Control", "List items matched using selection pattern");
                                                break;
                                            }
                                            else if (_controlValue == icb.ToString())  //Index
                                            {
                                                logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]: Search By Index " + _controlValue.ToLower());
                                                SelectionItemPattern selpat = (SelectionItemPattern)comboitems[icb].GetCurrentPattern(SelectionItemPattern.Pattern);
                                                logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]:match found for -->" + _controlValue.ToLower());
                                                selpat.Select();
                                                uilog.AddTexttoColumn("Action Performed on Control", "Selection done by index");
                                                break;
                                            }
                                            else if (TreeWalker.ControlViewWalker.GetFirstChild(comboitems[icb]) != null) // Find by the text childnode of Listitem
                                            {

                                                AutomationElement elementNode = TreeWalker.ControlViewWalker.GetFirstChild(comboitems[icb]);
                                                string _controltype = elementNode.Current.LocalizedControlType.ToString();
                                                logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]: Search By Text inside ListItem " + elementNode.Current.Name.ToLower());
                                                if (_controltype.ToLower() == "text" && elementNode.Current.Name.ToLower() == _controlValue.ToLower())
                                                {
                                                    logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]: Match Found " + elementNode.Current.Name.ToLower());
                                                    try
                                                    {
                                                        ClickControl(elementNode);
                                                        itemClicked = true;
                                                        uilog.AddTexttoColumn("Action Performed on Control", "Text node selected using autoit " + _controlName);
                                                    }
                                                    catch
                                                    {

                                                    }
                                                    if (itemClicked == false)
                                                    {
                                                        SelectionItemPattern selpat = (SelectionItemPattern)comboitems[icb].GetCurrentPattern(SelectionItemPattern.Pattern);
                                                        if (selpat != null)
                                                        {
                                                            selpat.Select();
                                                            uilog.AddTexttoColumn("Action Performed on Control", "Text node selected using selection pattern " + _controlName);
                                                        }
                                                    }
                                                    logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]:match found for -->" + _controlValue.ToLower());

                                                    break;
                                                }
                                            }

                                            else
                                            {
                                                logTofile(_eLogPtah, "[Adddata][uiautomationcombobox]:no condtition matched for  -->" + _controlValue.ToLower());
                                            }
                                        }

                                        break;

                                    /*   case "wpfcheckbox":
                                           if (_controlValue.Length > 0)
                                           {
                                               if (_controlValue.ToLower() == "on" || _controlValue.ToLower() == "1")
                                               {
                                                   wpfapp.GetWPFCheckBox(_globalWindow, _searchBy, _controlName, _index).Select();
                                                   uilog.AddTexttoColumn("Control Detected", "Yes");
                                                   uilog.AddTexttoColumn("Action Performed on Control", "Check the checkbox :");
                                               }
                                               else
                                               {
                                                   wpfapp.GetWPFCheckBox(_globalWindow, _searchBy, _controlName, _index).UnSelect();
                                                   uilog.AddTexttoColumn("Control Detected", "Yes");
                                                   uilog.AddTexttoColumn("Action Performed on Control", "UnCheck the checkbox :");
                                               }
                                           }
                                           break; */
                                    case "uiautomationcheckbox":
                                    case "ucheckbox":
                                        logTofile(_eLogPtah, "Inside [uiautomationcheckbox]:");
                                        if (_controlValue.Length > 0)
                                        {
                                            AutomationElement uiCheckBox = GetUIAutomationCheckBox(_searchBy, _controlName, _index);
                                            TogglePattern togPattern = (TogglePattern)uiCheckBox.GetCurrentPattern(TogglePattern.Pattern);
                                            ToggleState togstate = togPattern.Current.ToggleState;
                                            switch (_controlValue)
                                            {
                                                case "1":
                                                    if (togstate == ToggleState.Off)
                                                    {
                                                        togPattern.Toggle();
                                                    }
                                                    else
                                                        logTofile(_eLogPtah, "Checkbox is already checked");
                                                    break;
                                                case "0":
                                                    if (togstate == ToggleState.On)
                                                        togPattern.Toggle();
                                                    else
                                                        logTofile(_eLogPtah, "Checkbox is already unchecked");
                                                    break;
                                                case "c":
                                                    ClickControl(uiCheckBox);
                                                    break;
                                                default:
                                                    logTofile(_eLogPtah, "Provide valid input for control value i.e. either 1 or 0");
                                                    break;
                                            }
                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "Checkbox for " + _controlName + " need not be checked");
                                        }
                                        break;

                                    case "uiautomationlistitem":
                                    case "ulistitem":
                                        logTofile(_eLogPtah, "Inside [uiautomationlistitem]:");
                                        logTofile(_eLogPtah, "Control value length: " + _controlValue.Length);
                                        if (_controlValue.Length > 0)
                                        {
                                            AutomationElement uiListItem = GetUIAutomationListItem(_searchBy, _controlName, _index);
                                            TogglePattern togPattern = (TogglePattern)uiListItem.GetCurrentPattern(TogglePattern.Pattern);
                                            logTofile(_eLogPtah, "[Adddata][uiautomationlistitem]:match found for -->" + _controlValue.ToLower());
                                            togPattern.Toggle();
                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "ListItem for " + _controlName + " need not be checked");
                                        }
                                        break;
                                    case "codeduibutton":
                                        {

                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinButton winbutton = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (win == null)
                                            {
                                                logTofile(_eLogPtah, "Unable to find the window");
                                            }
                                            if (_index == -1)
                                            {
                                                winbutton = app.GetCUITButton(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                winbutton = app.GetCUITButton(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Inside [uiautomationlistitem]:");
                                            Mouse.Click(winbutton);
                                            Playback.Cleanup();
                                            break;
                                        }
                                    case "codeduidatarowheader":
                                        {

                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinRowHeader winrowheader = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                winrowheader = app.GetCUITDataRowHeader(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                winrowheader = app.GetCUITDataRowHeader(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Inside [uiautomationlistitem]:");
                                            Mouse.Click(winrowheader);
                                            Playback.Cleanup();
                                            break;
                                        }
                                    case "codeduidatacolumnheader":
                                        {

                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinColumnHeader wincolumnheader = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                wincolumnheader = app.GetCUITDataColumnHeader(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                wincolumnheader = app.GetCUITDataColumnHeader(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Inside [uiautomationlistitem]:");
                                            Mouse.Click(wincolumnheader);
                                            Playback.Cleanup();
                                            break;
                                        }
                                    case "codeduiradiobutton":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinRadioButton radioButton = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                radioButton = app.GetCUITRadioButton(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                radioButton = app.GetCUITRadioButton(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            Mouse.Click(radioButton);
                                            Playback.Cleanup();
                                            break;

                                        }
                                    case "codeduidatarow":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinRow row = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                row = app.GetCUITDataRow(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                row = app.GetCUITDataRow(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            Playback.Cleanup();
                                            break;

                                        }
                                    case "codeduidatacell":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinCell cell = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                cell = app.GetCUITDataCell(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                cell = app.GetCUITDataCell(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            cell.Value = _controlValue;
                                            Playback.Cleanup();
                                            break;
                                        }
                                    case "codeduimenuitem":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinMenuItem menuItem = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                menuItem = app.GetCUITMenuItem(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                menuItem = app.GetCUITMenuItem(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            switch (_controlValue.ToLower())
                                            {
                                                case "1":
                                                    Mouse.Click(menuItem);
                                                    break;
                                                case "r":
                                                    Mouse.Click(menuItem, System.Windows.Forms.MouseButtons.Right);
                                                    break;
                                                case "d":
                                                    Mouse.DoubleClick(menuItem);
                                                    break;
                                                default:
                                                    Console.WriteLine("No valid input provided for clicking image");
                                                    break;
                                            }
                                            Mouse.DoubleClick(menuItem);
                                            Playback.Cleanup();
                                            break;

                                        }
                                    case "codeduilistitem":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinListItem listitem = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                listitem = app.GetCUITListItem(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                listitem = app.GetCUITListItem(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            Mouse.Click(listitem);
                                            Playback.Cleanup();
                                            break;

                                        }
                                    case "codeduilist":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinList list = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                list = app.GetCUITList(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                list = app.GetCUITList(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            int item = int.Parse(_controlValue);
                                            int[] selected = new int[1];
                                            selected[0] = item - 1;
                                            list.SelectedIndices = selected;
                                            Playback.Cleanup();
                                            break;

                                        }
                                    case "codeduitextcontrol":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinText text = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                text = app.GetCUITTextcontrol(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                text = app.GetCUITTextcontrol(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            Mouse.Click(text);
                                            Playback.Cleanup();
                                            break;

                                        }
                                    case "codeduitreeitem":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinTreeItem treeItem = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                treeItem = app.GetCUITTreeItem(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                treeItem = app.GetCUITTreeItem(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            switch (_controlValue.ToLower())
                                            {
                                                case "1":
                                                    Mouse.Click(treeItem);
                                                    break;
                                                case "r":
                                                    Mouse.Click(treeItem, System.Windows.Forms.MouseButtons.Right);
                                                    break;
                                                case "d":
                                                    Mouse.DoubleClick(treeItem);
                                                    break;
                                                default:
                                                    Console.WriteLine("No valid input provided for clicking image");
                                                    break;
                                            }
                                            Playback.Cleanup();
                                            break;

                                        }
                                    case "codeduicheckbox":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinCheckBox checkBox = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                checkBox = app.GetCUITCHeckbox(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                checkBox = app.GetCUITCHeckbox(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            if (_controlValue == "0")
                                            {
                                                checkBox.Checked = false;
                                            }
                                            else
                                            {
                                                checkBox.Checked = true;
                                            }
                                            Playback.Cleanup();
                                            break;

                                        }
                                    case "codeduitabpage":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinTabPage tab = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);
                                            if (_index == -1)
                                            {
                                                tab = app.GetCUITTabpage(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                tab = app.GetCUITTabpage(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            Mouse.Click(tab);
                                            logTofile(_eLogPtah, "Clicked Tab Page");
                                            Playback.Cleanup();
                                            break;

                                        }
                                    case "codeduiedit":
                                        {
                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinEdit edit = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);

                                            if (_index == -1)
                                            {
                                                edit = app.GetCUITEdit(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                edit = app.GetCUITEdit(win, _searchBy, _controlName, _index);
                                            }

                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            if (edit.Enabled)
                                            {
                                                edit.SetFocus();
                                                edit.Text = _controlValue;
                                            }
                                            Playback.Cleanup();
                                            break;

                                        }
                                    case "clickcordinates":
                                        {
                                            string[] coordinates;
                                            coordinates = _controlName.Split(',');
                                            AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3();
                                            int x1 = Convert.ToInt32(coordinates[0]);
                                            int y1 = Convert.ToInt32(coordinates[1]);
                                            at1.MouseClick("LEFT", x1, y1, 1);
                                            break;
                                        }
                                    case "codeduicombobox":
                                        {

                                            clsCUIT_app app = new clsCUIT_app();
                                            app._eLogPtah = _eLogPtah;
                                            WinComboBox comboBox = null;
                                            WinWindow win = app.GetCUITWindow(parentSearchBy, parentSearchValue);

                                            if (_index == -1)
                                            {
                                                comboBox = app.GetCUITComboBox(win, _searchBy, _controlName, -1);
                                            }
                                            else
                                            {
                                                comboBox = app.GetCUITComboBox(win, _searchBy, _controlName, _index);
                                            }
                                            Playback.Initialize();
                                            logTofile(_eLogPtah, "Playback Initialized");
                                            int selectedIndex = int.Parse(_controlValue);
                                            comboBox.SelectedIndex = selectedIndex;
                                            Playback.Cleanup();
                                            break;

                                        }

                                    case "uiautomationselectlistitem":
                                    case "uselectlistitem":
                                    case "ulistitemselect":
                                        logTofile(_eLogPtah, "Inside [uiautomationselectlistitem]:");
                                        logTofile(_eLogPtah, "Control value length: " + _controlValue.Length);
                                        if (_controlValue.Length > 0)
                                        {
                                            AutomationElement uiListItem = GetUIAutomationListItem(_searchBy, _controlName, _index);
                                            SelectionItemPattern selpat = (SelectionItemPattern)uiListItem.GetCurrentPattern(SelectionItemPattern.Pattern);
                                            selpat.Select();

                                            logTofile(_eLogPtah, "[Adddata][uiautomationselectlistitem]:match found for -->" + _controlValue.ToLower());

                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "ListItem for " + _controlName + " need not be selected");
                                        }
                                        break;

                                    case "uiautomationclicklistitem":
                                    case "uclicklistitem":
                                    case "ulistitemclick":
                                        logTofile(_eLogPtah, "Inside [uiautomationclicklistitem]:");
                                        logTofile(_eLogPtah, "Control value length: " + _controlValue.Length);
                                        if (_controlValue.Length > 0)
                                        {
                                            AutomationElement uiListItem = GetUIAutomationListItem(_searchBy, _controlName, _index);
                                            switch (_controlValue.ToLower())
                                            {
                                                case "1":
                                                    ClickControl(uiListItem);
                                                    break;
                                                case "l":
                                                    ClickControl(uiListItem);
                                                    break;
                                                case "r":
                                                    RightClickControl(uiListItem);
                                                    break;
                                                case "d":
                                                    DoubleClickControl(uiListItem);
                                                    break;
                                                default:
                                                    Console.WriteLine("No valid input provided for clicking image");
                                                    break;
                                            }

                                            logTofile(_eLogPtah, "[Adddata][uiautomationselectlistitem]:match found for -->" + _controlValue.ToLower());

                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "ListItem for " + _controlName + " need not be selected");
                                        }
                                        break;

                                    case "uiautomationradiobutton":
                                    case "uradiobutton":
                                        if (_controlValue.ToLower().Equals("1"))
                                        {
                                            AutomationElement uiRadio = GetUIAutomationRadioButton(_searchBy, _controlName, _index);
                                            SelectionItemPattern selpat = (SelectionItemPattern)uiRadio.GetCurrentPattern(SelectionItemPattern.Pattern);
                                            logTofile(_eLogPtah, "[Adddata][uiautomationradiobutton]: match found for  -->" + _controlValue.ToLower());
                                            selpat.Select();
                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "Radio Button for " + _controlName + " need not be selected");
                                        }
                                        break;
                                    /*   case "wpfbutton":
                                           if (_controlValue.Length > 0)
                                               logTofile(_eLogPtah, "[AddData]:[wpfbutton]:Trying to Click Button:== " + _logicalName);
                                           {
                                               try
                                               {
                                                   if (wpfapp.GetWPFButton(_globalWindow, _searchBy, _controlName, _index) != null)
                                                   {
                                                       uilog.AddTexttoColumn("Control Detected", "Yes");
                                                   }
                                                   else
                                                   {
                                                       uilog.AddTexttoColumn("Control Detected", "No");
                                                   }
                                                   wpfapp.GetWPFButton(_globalWindow, _searchBy, _controlName, _index).Click();

                                                   uilog.AddTexttoColumn("Action Performed on Control", "Click  button [White method]: " + _controlName);
                                                   logTofile(_eLogPtah, "[AddData]:[wpfbutton]:Trying to Clicked Button:== " + _logicalName);
                                               }
                                               catch (Exception ex)
                                               {
                                                   logTofile(_eLogPtah, "Error in wpfbutton:" + ex.ToString());
                                               }
                                           }
                                           break; */

                                    case "splitterdropdown":
                                        logTofile(_eLogPtah, "Got Control type Splieeter");
                                        logTofile(_eLogPtah, "SearchBy " + _searchBy + "Search value" + _controlName + "index" + _index);

                                        break;
                                    case "pvmaskedit":
                                        if (_controlValue.Length > 0)
                                        {
                                            AutomationElement uiPvMaskedit = GetUIAutomationPVMaskEdit(_searchBy, _controlName, _index);

                                            ClickControl(uiPvMaskedit);
                                            Thread.Sleep(2000);
                                            KeyBoardEnter(_controlValue);

                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "Radio Button for " + _controlName + " need not be selected");
                                        }
                                        break;

                                    case "pvcombobox":
                                        if (_controlValue.Length > 0)
                                        {
                                            AutomationElement uiPvCombo = GetUIAutomationbutton(_searchBy, _controlName, _index);

                                            ClickControl(uiPvCombo);
                                            Thread.Sleep(2000);
                                            Playback.Initialize();
                                            WinWindow cmbwin = new WinWindow();
                                            cmbwin.SearchProperties.Add(WinWindow.PropertyNames.Name, "ComboBox");

                                            while (cmbwin.Exists == false)
                                            {
                                                ClickControl(uiPvCombo);
                                                Playback.Wait(2000);

                                            }
                                            Console.WriteLine("Combowin exists confirmed");
                                            WinWindow listwin = new WinWindow(cmbwin);
                                            listwin.WindowTitles.Add("ComboBox");
                                            listwin.SetFocus();
                                            WinList flist = new WinList(listwin);
                                            flist.WindowTitles.Add("ComboBox");
                                            Playback.Wait(2000);
                                            int ik = 0;
                                            while (flist.Exists == false)
                                            {
                                                Console.WriteLine("Clcik was not performed with enough strength:  " + ik);
                                                ClickControl(uiPvCombo);
                                                Playback.Wait(2000);
                                                ik++;
                                            }
                                            Console.WriteLine("List obtained Confirmd");

                                            AutomationElement ae = AutomationElement.RootElement;
                                            Condition cond = new System.Windows.Automation.AndCondition(
                                                new System.Windows.Automation.PropertyCondition(AutomationElement.ControlTypeProperty, System.Windows.Automation.ControlType.Window),
                                                new System.Windows.Automation.PropertyCondition(AutomationElement.NameProperty, "ComboBox", PropertyConditionFlags.IgnoreCase)
                                                );
                                            AutomationElement cmbowin = ae.FindFirst(TreeScope.Descendants, cond);

                                            Condition cond2 =
                                               new System.Windows.Automation.PropertyCondition(AutomationElement.ControlTypeProperty, System.Windows.Automation.ControlType.DataItem);

                                            AutomationElementCollection alldataitems = cmbowin.FindAll(TreeScope.Descendants, cond2);
                                            Console.WriteLine("Got collection count =" + alldataitems.Count);
                                            foreach (AutomationElement inditem in alldataitems)
                                            {
                                                if (inditem.Current.Name == _controlValue)
                                                {
                                                    InvokePattern invk = (InvokePattern)inditem.GetCurrentPattern(InvokePattern.Pattern);
                                                    invk.Invoke();
                                                    break;
                                                }
                                            }

                                            //  flist.SelectedItemsAsString = selvalue;
                                            Playback.Cleanup();
                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "Radio Button for " + _controlName + " need not be selected");
                                        }
                                        break;
                                    /*  case "wpfradiobutton":
                                          try
                                          {
                                              if (_controlValue.Length > 0)
                                              {
                                                  if (wpfapp.GetWPFRadioButton(_globalWindow, _searchBy, _controlName, _index) != null)
                                                  {
                                                      uilog.AddTexttoColumn("Control Detected", "Yes");
                                                  }
                                                  else
                                                  {
                                                      uilog.AddTexttoColumn("Control Detected", "No");
                                                  }
                                                  wpfapp.GetWPFRadioButton(_globalWindow, _searchBy, _controlName, _index).Select();
                                                  uilog.AddTexttoColumn("Control Detected", "Yes");
                                                  uilog.AddTexttoColumn("Action Performed on Control", "selected Radio button:" + _controlName);
                                                  Thread.Sleep(1000);
                                              }

                                          }
                                          catch (Exception ex)
                                          {
                                              uilog.AddTexttoColumn("Control Detected", "No");
                                              logTofile(_eLogPtah, "[AddData][wpfradiobutton]: Could not Find Object with Given Search conditions in application." + ex.Message.ToString());
                                          }
                                          break;
                                      case "wpftextbox":
                                          if (_controlValue != DBNull.Value.ToString())
                                          {
                                              if (_globalWindow == null)
                                              {
                                                  logTofile(_eLogPtah, "Add Data : Ooops Global window was got as Null !!!!");
                                              }
                                              if (wpfapp.GetWPFTextBox(_globalWindow, _searchBy, _controlName, _index) != null)
                                              {
                                                  uilog.AddTexttoColumn("Control Detected", "Yes");
                                              }
                                              else
                                              {
                                                  uilog.AddTexttoColumn("Control Detected", "No");
                                              }
                                              wpfapp.GetWPFTextBox(_globalWindow, _searchBy, _controlName, _index).SetValue(_controlValue);
                                              uilog.AddTexttoColumn("Action Performed on Control", "Enter Value in TextBox :" + _controlValue);
                                              System.Windows.Forms.SendKeys.SendWait("{TAB}");
                                          }
                                          break;

                                   /*   case "wpfmultilinetextbox":
                                          logTofile(_eLogPtah, "  [Add Data]->[wpfmultilinetextbox]-->looking for " + _logicalName);
                                          logTofile(_eLogPtah, "  [Add Data]->[wpfmultilinetextbox]-->Global Parent " + _globalWindow.Name.ToString());
                                          if (uiAutomationCurrentParent != null)
                                          {
                                              logTofile(_eLogPtah, " [AddData]->wpfmultileinetextbox uicurrent parent " + uiAutomationCurrentParent.Current.Name + " Automation Id" + uiAutomationCurrentParent.Current.AutomationId + "Control Type: " + uiAutomationCurrentParent.Current.ControlType.ToString()
                                                  );
                                          }
                                          else
                                          {
                                              logTofile(_eLogPtah, " [AddData]->wpfmultileinetextbox uicurrent parnet  was still null ");
                                          }
                                          if (_controlValue != DBNull.Value.ToString())
                                          {
                                              SearchCriteria _tbsearchcriteria = SearchCriteria.ByText(_controlName);
                                              {
                                                  logTofile(_eLogPtah, " Function --> Add Data- >global window was not set ..trying to set it  first ");
                                                  //   GetUIAutomationWindow(parentSearchBy, parentSearchValue);
                                              }
                                              try
                                              {
                                                  var tbeditor = _globalWindow.Get<MultilineTextBox>(_tbsearchcriteria);

                                                  if (tbeditor != null)
                                                  {
                                                      uilog.AddTexttoColumn("Control Detected", "Yes");
                                                  }
                                                  else
                                                  {
                                                      uilog.AddTexttoColumn("Control Detected", "No");
                                                  }
                                                  logTofile(_eLogPtah, "[AddData]->[wpfmultileinetextbox] : chekcing if this editor box is enabled or no " + tbeditor.Enabled);
                                                  // if (tbeditor.Enabled==true)
                                                  // {
                                                  tbeditor.Click();
                                                  System.Windows.Forms.SendKeys.Flush();
                                                  System.Windows.Forms.SendKeys.SendWait("{HOME}");
                                                  System.Windows.Forms.SendKeys.Flush();
                                                  System.Windows.Forms.SendKeys.SendWait("+{END}");
                                                  System.Windows.Forms.SendKeys.Flush();
                                                  System.Windows.Forms.SendKeys.SendWait("{DEL}");
                                                  // }
                                                  // *************Clear all vlaues ========================

                                                  // *************Clear all vlaues ========================
                                                  if (tbeditor != null)
                                                  {
                                                      logTofile(_eLogPtah, "[AddData]->[wpfmultileinetextbox] : multileline textbox  ");
                                                  }
                                                  else
                                                  {
                                                      logTofile(_eLogPtah, "[AddData]->[wpfmultileinetextbox] : Error in detecting  multilline textbox:  ");
                                                  }
                                                  tbeditor.Text = _controlValue;
                                                  logTofile(_eLogPtah, "[AddData]->[wpfmultileinetextbox] : Trying to  input on data editor ");
                                                  if (tbeditor.Text != _controlValue)
                                                  {
                                                      logTofile(_eLogPtah, "[AddData]->[wpfmultileinetextbox]  Error in inputing Data data was Not input properly by white  ");
                                                  }

                                                  uilog.AddTexttoColumn("Action Performed on Control", "Enter Value in TextBoxmulti (WPF) :" + _controlValue);
                                              }
                                              catch (Exception ex)
                                              {
                                                  logTofile(_eLogPtah, " [AddData]->[wpfmultileinetextbox] Error retriving WPfmultilene textbox " + ex.Message.ToString());
                                              }

                                          }
                                          break; */

                                    case "maskedwpftextbox":
                                        logTofile(_eLogPtah, " Inside->[maskedwpftextbox] ");
                                        AutomationElement maskeditbox = GetUIAutomationEdit(_searchBy, _controlName, _index);
                                        logTofile(_eLogPtah, "Obtained the maskedit box");
                                        logTofile(_eLogPtah, "bonding rec value" + maskeditbox.Current.BoundingRectangle.Y.ToString());
                                        ValuePattern editval1 = (ValuePattern)maskeditbox.GetCurrentPattern(ValuePattern.Pattern);
                                        editval1.SetValue("");
                                        editval1.SetValue(_controlValue);
                                        break;
                                    case "uiautomationedit":
                                    case "uedit":
                                        AutomationElement editbox = GetUIAutomationEdit(_searchBy, _controlName, _index);

                                        if (editbox != null)
                                        {
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:-> controlname " + _controlName + " was found ");
                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:-> controlname " + _controlName + " was NOT found ");
                                        }
                                        if (_controlValue != null)
                                        {
                                            try
                                            {

                                                editbox.SetFocus();
                                            }
                                            catch (Exception ex)
                                            {
                                                logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:-setfocus issue encoutered " + ex.Message.ToString());
                                            }
                                        }

                                        logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:- Searching for Value Pattern");
                                        ValuePattern editval = null;
                                        try
                                        {
                                            editval = (ValuePattern)editbox.GetCurrentPattern(ValuePattern.Pattern);
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:- Value Pattern found");
                                            editval.SetValue(_controlValue);
                                            uilog.AddTexttoColumn("Action Performed on Control", "Entered Value: [Value Pattern]" + _controlValue);
                                        }
                                        catch
                                        {
                                            if (editval == null) //no value pattern found
                                            {
                                                logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:- Value Pattern not found");
                                                ClickControl(editbox);
                                                System.Windows.Forms.SendKeys.Flush();
                                                System.Windows.Forms.SendKeys.SendWait(_controlValue);
                                            }

                                        }
                                        logTofile(_eLogPtah, "[AddData]->[uiautomationedit]:- Value entered successfully");

                                        break;
                                    case "uiautomationtextarea":
                                    case "utextarea":
                                        AutomationElement textarea = GetUIAutomationTextarea(_searchBy, _controlName, _index);
                                        if (textarea != null)
                                        {
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationtextarea]:-> controlname " + _controlName + " was found ");
                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationtextarea]:-> controlname " + _controlName + " was NOT found ");
                                        }
                                        if (_controlValue != null)
                                        {
                                            try
                                            {
                                                if (textarea.Current.IsKeyboardFocusable == true)
                                                {
                                                    textarea.SetFocus();
                                                }
                                                try
                                                {
                                                    ClickControl(textarea);
                                                }
                                                catch (Exception ex)
                                                {
                                                    logTofile(_eLogPtah, "[AddData]->[uiautomationtextarea]:-Clickble epoints issue: " + ex.Message.ToString());
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                logTofile(_eLogPtah, "[AddData]->[uiautomationtextarea]:-setfocus issue encoutered " + ex.Message.ToString());
                                            }
                                        }
                                        if (textarea.Current.IsEnabled == true)
                                        {
                                            TextPattern txtptn = (TextPattern)textarea.GetCurrentPattern(TextPattern.Pattern);
                                            // following loop is just to ensure that values are entered correctly in textbox.
                                            string rtt = txtptn.DocumentRange.GetText(10000);
                                            do
                                            {
                                                System.Windows.Forms.SendKeys.Flush();
                                                System.Windows.Forms.SendKeys.SendWait("{HOME}");
                                                System.Windows.Forms.SendKeys.Flush();
                                                System.Windows.Forms.SendKeys.SendWait("+{END}");
                                                System.Windows.Forms.SendKeys.Flush();
                                                System.Windows.Forms.SendKeys.SendWait("{DEL}");
                                                System.Windows.Forms.SendKeys.SendWait(_controlValue);

                                                txtptn = (TextPattern)textarea.GetCurrentPattern(TextPattern.Pattern);
                                                rtt = txtptn.DocumentRange.GetText(10000);
                                                logTofile(_eLogPtah, "checking for value " + rtt.ToString());
                                            } while (rtt != _controlValue);
                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "Target TextBox is not enabled for entering data");
                                        }
                                        uilog.AddTexttoColumn("Action Performed on Control", "Enter Value: using keystrokes " + _controlValue);
                                        break;

                                    case "uiautomationcustominvokecontrol":
                                    case "ucustominvokecontrol":
                                    case "ucustominvoke":
                                        logTofile(_eLogPtah, "[AddData]->[uiautomationcustominvokecontrol] ControlValue" + _controlName + " : Length is " + _controlName.Length);
                                        AutomationElement customcontrol = GetUIAutomationCustominvokecontrol(_searchBy, _controlName, _index);
                                        try
                                        {
                                            InvokePattern invkptn = (InvokePattern)customcontrol.GetCurrentPattern(InvokePattern.Pattern);
                                            if (_controlValue.ToLower() == "y" || _controlValue == "1")
                                            {
                                                invkptn.Invoke();
                                                uilog.AddTexttoColumn("Action Performed on Control", "Invoke:");
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            uilog.AddTexttoColumn("Action Performed on Control", "Failed in Invoke:");
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationcustominvokecontrol]" + ex.Message.ToString());
                                        }

                                        break;

                                    case "uiautomationcustomclickcontrol":
                                    case "ucustomclickcontrol":
                                        AutomationElement customclickcontrol = GetUIAutomationCustominvokecontrol(_searchBy, _controlName, _index);
                                        try
                                        {
                                            if (_controlValue.Length > 0)
                                            {
                                                switch (_controlValue.ToLower())
                                                {
                                                    case "l":
                                                    case "1":
                                                        ClickControl(customclickcontrol);
                                                        break;
                                                    case "r":
                                                        RightClickControl(customclickcontrol);
                                                        break;
                                                    case "d":
                                                        DoubleClickControl(customclickcontrol);
                                                        break;
                                                    default:
                                                        Console.WriteLine("No valid input provided for clicking customclickcontrol");
                                                        break;
                                                }
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationcustomclickcontrol]" + ex.Message.ToString());
                                        }

                                        break;

                                    case "uiautomationcustomvaluecontrol":
                                    case "ucustomvaluecontrol":
                                        AutomationElement customvaluecontrol1 = GetUIAutomationCustomvaluecontrol(_searchBy, _controlName, _index);
                                        if (customvaluecontrol1 != null)
                                        {
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationcustomvaluecontrol] Control was found ");
                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationcustomvaluecontrol] Control was NOt found ");
                                        }
                                        try
                                        {
                                            ValuePattern invkptn = (ValuePattern)customvaluecontrol1.GetCurrentPattern(ValuePattern.Pattern);
                                            invkptn.SetValue(_controlValue);
                                        }
                                        catch (Exception ex)
                                        {
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationcustomvaluecontrol]" + ex.Message.ToString());
                                        }

                                        break;
                                    case "uiautomationcustomrightclickcontrol":
                                    case "ucustomrightclickcontrol":
                                        AutomationElement customcontrolrightclick = GetUIAutomationCustominvokecontrol(_searchBy, _controlName, _index);
                                        if (customcontrolrightclick != null)
                                        {
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationcustomrightclickcontrol] Control was found ");
                                            try
                                            {
                                                RightClickControl(customcontrolrightclick);
                                            }
                                            catch (Exception ex)
                                            {
                                                logTofile(_eLogPtah, "[AddData]->[uiautomationcustomrightclickcontrol]" + ex.Message.ToString());
                                            }
                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "[AddData]->[uiautomationcustomrightclickcontrol] Control was NOt found ");
                                        }

                                        break;

                                    case "uiautomationultratabitem":
                                    case "uultratabitem":
                                    case "utabitem":
                                        AutomationElement ultratabitem = GetUIAutomationUltratab(_searchBy, _controlName, _index);
                                        logTofile(_eLogPtah, "[AddData]->[uiautomationultratabitem] Ultra Tab Name" + ultratabitem.Current.Name);
                                        AutomationElement objbuttonnext = null;
                                        if (objbuttonnext == null)
                                        {
                                            try
                                            {
                                                if (ultratabitem.Current.IsKeyboardFocusable == true)
                                                {
                                                    ultratabitem.SetFocus();
                                                }

                                                ClickControl(ultratabitem);
                                                uilog.AddTexttoColumn("Action Performed on Control", "Click Object: Autoit " + _controlName);
                                                logTofile(_eLogPtah, "Clicked the ultratabitem using clickcontrol ");

                                            }
                                            catch (Exception e)
                                            {

                                                SelectionItemPattern selpat = (SelectionItemPattern)ultratabitem.GetCurrentPattern(SelectionItemPattern.Pattern);
                                                selpat.Select();
                                                uilog.AddTexttoColumn("Action Performed on Control", "Click Object: Select Pattern (from Catch block) " + _controlName);
                                                logTofile(_eLogPtah, "Clicked using Selection Pattern " + e.Message);

                                            }
                                        }
                                        else
                                        // need to detect until no error
                                        {
                                            try
                                            {
                                                ClickControl(ultratabitem);
                                            }
                                            catch (Exception e)
                                            {
                                                SelectionItemPattern selpat = (SelectionItemPattern)ultratabitem.GetCurrentPattern(SelectionItemPattern.Pattern);
                                                selpat.Select();
                                                logTofile(_eLogPtah, "Catch block " + e.Message);
                                                logTofile(_eLogPtah, "Clicked using Selection Pattern ");

                                            }
                                        }
                                        break;
                                    case "uiautomationselectultratabitem":
                                    case "uselectultratabitem":
                                        AutomationElement ultratabitemSelect = GetUIAutomationUltratab(_searchBy, _controlName, _index);
                                        logTofile(_eLogPtah, "[AddData]->[uiautomationselectultratabitem] Ultra Tab Name" + ultratabitemSelect.Current.Name);

                                        try
                                        {
                                            if (ultratabitemSelect.Current.IsKeyboardFocusable == true)
                                            {
                                                ultratabitemSelect.SetFocus();
                                            }

                                            SelectionItemPattern selpat = (SelectionItemPattern)ultratabitemSelect.GetCurrentPattern(SelectionItemPattern.Pattern);
                                            selpat.Select();
                                            uilog.AddTexttoColumn("Action Performed on Control", "Clicked using Selection Pattern " + _controlName);
                                            logTofile(_eLogPtah, "Clicked using Selection Pattern ");

                                        }
                                        catch (Exception e)
                                        {
                                            logTofile(_eLogPtah, "Error encountered in uiautomationselectultratabitem: " + e.Message);
                                            throw new Exception("uiautomationselectultratabitem" + e.Message);
                                        }
                                        break;
                                    case "uiautomationbutton":
                                    case "ubutton":
                                        if (_controlValue.Length > 0)
                                        {
                                            if (uiAutomationWindow.Current.Name.Length == 0)
                                            {
                                                uiAutomationWindow = GetUIAutomationWindow(parentSearchBy, parentSearchValue);
                                            }

                                            AutomationElement button = GetUIAutomationbutton(_searchBy, _controlName, _index);

                                            string bname = button.Current.Name.ToString();
                                            logTofile(_eLogPtah, "[AddData][uiautomationbutton]:Retrived button contol  : " + bname);
                                            logTofile(_eLogPtah, "Clicking the button using Invoke pattern");

                                            try
                                            {
                                                InvokePattern invkbuttonptn = (InvokePattern)button.GetCurrentPattern(InvokePattern.Pattern);
                                                logTofile(_eLogPtah, "Got the Invoke Pattern");
                                                if (Convert.IsDBNull(_controlValue) == false)

                                                    if (Int32.Parse(_controlValue) > 0)
                                                    {
                                                        logTofile(_eLogPtah, "[AddData][uiautomationbutton]: Button will be clicked : " + _controlValue.ToString() + ":Times");
                                                        for (int ib = 0; ib < Int32.Parse(_controlValue); ib++)
                                                        {
                                                            invkbuttonptn.Invoke();
                                                            System.Threading.Thread.Sleep(20);
                                                            logTofile(_eLogPtah, "[AddData][uiautomationbutton]:Clicked button : " + bname + "Times:" + ib.ToString());
                                                        }
                                                    }
                                                uilog.AddTexttoColumn("Action Performed on Control", "Invoke Pattern");
                                            }
                                            catch
                                            {
                                                logTofile(_eLogPtah, "No  Invoke Pattern hence using Click Control");
                                                ClickControl(button);
                                                uilog.AddTexttoColumn("Action Performed on Control", "Invoke Pattern");
                                            }
                                        }

                                        break;

                                    case "uiautomationtogglebutton":
                                    case "utogglebutton":
                                        logTofile(_eLogPtah, "Inside [uiautomationtogglebutton]:");
                                        if (_controlValue.Length > 0)
                                        {
                                            AutomationElement uiTogbutton = GetUIAutomationbutton(_searchBy, _controlName, _index);
                                            TogglePattern togPattern = (TogglePattern)uiTogbutton.GetCurrentPattern(TogglePattern.Pattern);
                                            ToggleState togstate = togPattern.Current.ToggleState;
                                            switch (_controlValue)
                                            {
                                                case "1":
                                                    if (togstate == ToggleState.Off)
                                                        togPattern.Toggle();
                                                    else
                                                        logTofile(_eLogPtah, "Button is already in On state");
                                                    break;
                                                case "0":
                                                    if (togstate == ToggleState.On)
                                                        togPattern.Toggle();
                                                    else
                                                        logTofile(_eLogPtah, "Button is already in Off state");
                                                    break;
                                                default:
                                                    logTofile(_eLogPtah, "Provide valid input for control value i.e. either 1 or 0");
                                                    break;
                                            }
                                        }
                                        else
                                        {
                                            logTofile(_eLogPtah, "Button for " + _controlName + " need not be clicked");
                                        }
                                        break;

                                    case "uiautomationribbonbutton":
                                    case "uribbonbutton":
                                        if (uiAutomationWindow.Current.Name.Length == 0)
                                        {
                                            uiAutomationWindow = GetUIAutomationWindow(parentSearchBy, parentSearchValue);
                                        }
                                        AutomationElement ribbonbutton = GetUIAutomationRibbonButton(_searchBy, _controlName, _index);
                                        logTofile(_eLogPtah, "[AddData][uiautomationribbonbutton]:Retrived Ribbonbutton contol");
                                        ClickControl(ribbonbutton);
                                        uilog.AddTexttoColumn("Action Performed on Control", "Click Control using autoit");
                                        System.Threading.Thread.Sleep(20);
                                        logTofile(_eLogPtah, "[AddData][uiautomationribbonbutton]:Pressed Ribbonbutton   : " + _logicalName);

                                        break;

                                    case "uiautomationtreeitemclick":
                                    case "utreeitemclick":
                                        if (_controlValue.Length > 0)
                                        {
                                            _controlName = _controlValue;
                                        }
                                        AutomationElement treeitem = GetUIAutomationtreeitem(_searchBy, _controlName, _index);
                                        ClickControl(treeitem);
                                        uilog.AddTexttoColumn("Action Performed on Control", "Click Tree item with text: " + _controlName);

                                        break;

                                    case "uiautomationtreeitem":
                                    case "utreeitem":
                                        {
                                            if (_controlValue.Length > 0)
                                            {
                                                AutomationElement treeviewitem = GetUIAutomationtreeitem(_searchBy, _controlName, _index);

                                                switch (_controlValue.ToLower())
                                                {
                                                    case "l":
                                                        ClickControl(treeviewitem);
                                                        break;
                                                    case "r":
                                                        RightClickControl(treeviewitem);
                                                        break;
                                                    case "d":
                                                        DoubleClickControl(treeviewitem);
                                                        break;
                                                    default:
                                                        Console.WriteLine("No valid input provided for clicking treeitem");
                                                        break;
                                                }
                                            }
                                            break;
                                        }

                                    //this method is used for both expanding and collapsing the Tree nnodes
                                    case "uiautomationtreeitemexpand":
                                    case "utreeitemexpand":
                                        if (_controlValue.Length > 0)
                                        {
                                            _controlName = _controlValue;
                                        }
                                        AutomationElement treeitemcolapsed = GetUIAutomationtreeitem(_searchBy, _controlName, _index);
                                        DoubleClickControl(treeitemcolapsed);
                                        break;

                                    case "uiautomationtreeitemexpandk2":
                                    case "utreeitemexpandk2":
                                        if (_controlValue.Length > 0)
                                        {
                                            AutomationElement treeviewitem = GetUIAutomationtreeitem(_searchBy, _controlName, _index);
                                            ExpandCollapsePattern collapsepat = (ExpandCollapsePattern)treeviewitem.GetCurrentPattern(ExpandCollapsePattern.Pattern);
                                            ExpandCollapseState state = collapsepat.Current.ExpandCollapseState;
                                            if (state == ExpandCollapseState.Collapsed || state == ExpandCollapseState.PartiallyExpanded)
                                            {
                                                collapsepat.Expand();
                                                logTofile(_eLogPtah, "Tree item expanded");
                                            }
                                            else
                                                logTofile(_eLogPtah, " tree item is already expanded");
                                        }
                                        break;

                                    case "uiautomationtreeitemcollapsek2":
                                    case "utreeitemcollapsek2":
                                        if (_controlValue.Length > 0)
                                        {
                                            AutomationElement treeviewitem = GetUIAutomationtreeitem(_searchBy, _controlName, _index);
                                            ExpandCollapsePattern expandpat = (ExpandCollapsePattern)treeviewitem.GetCurrentPattern(ExpandCollapsePattern.Pattern);
                                            ExpandCollapseState state = expandpat.Current.ExpandCollapseState;
                                            if (state == ExpandCollapseState.Expanded)
                                            {
                                                expandpat.Collapse();
                                                logTofile(_eLogPtah, "Tree item collapsed");
                                            }
                                            else
                                                logTofile(_eLogPtah, " tree item is already collapsed");
                                        }
                                        break;

                                    case "uiautomationsyncfusionpane":
                                    case "usyncfusionpane":
                                        AutomationElement syncfusionpane = GetUIAutomationsyncfusionpane(_searchBy, _controlName, _index);
                                        //   syncfusionpane.SetFocus();this mehtod dud not work hence using clickable point
                                        logTofile(_eLogPtah, "Datagrid : " + syncfusionpane.Current.Name);
                                        Console.WriteLine("[AddData][uiautomationsyncfusionpane]:-->before trying getclick");
                                        ClickControl(syncfusionpane);
                                        uilog.AddTexttoColumn("Action Performed on Control", "Click object");
                                        if (_controlValue != null)
                                        {
                                            char[] celldellim = new char[] { '|' };
                                            string[] arrcelladd = _controlValue.Split(celldellim);
                                            foreach (var item in arrcelladd)
                                            {
                                                // split control value in an array
                                                char[] delim = new char[] { ';' };
                                                string[] arr = item.Split(delim);

                                                string rowval = arr[0];
                                                string colval = arr[1];
                                                string offsetval = arr[2];
                                                string dataval = arr[3];
                                                if (_controlName1.ToLower() != "{tab}" && _controlName1.ToLower() != "{right}")
                                                    System.Console.WriteLine("uiautomationsyncfusionpane]->Wrong value in French value column of structure sheet");
                                                setcellvaleps(rowval, colval, offsetval, dataval, _controlName1);
                                            }
                                        }
                                        break;
                                    case "uiautomationsyncfusionpanereo":
                                    case "usyncfusionpanereo":
                                        AutomationElement syncfusionpanereo = GetUIAutomationsyncfusionpane(_searchBy, _controlName, _index);
                                        //   syncfusionpane.SetFocus();this mehtod dud not work hence using clickable point
                                        logTofile(_eLogPtah, "Datagrid : " + syncfusionpanereo.Current.Name);
                                        Console.WriteLine("[AddData][uiautomationsyncfusionpane]:-->before trying getclick");
                                        //ClickControl(syncfusionpanereo);
                                        if (_controlValue != null)
                                        {
                                            char[] celldellim = new char[] { '|' };
                                            string[] arrcelladd = _controlValue.Split(celldellim);
                                            foreach (var item in arrcelladd)
                                            {
                                                // split control value in an array
                                                char[] delim = new char[] { ';' };
                                                string[] arr = item.Split(delim);

                                                string rowval = arr[0];
                                                string colval = arr[1];
                                                string offsetval = arr[2];
                                                string dataval = arr[3];
                                                if (_controlName1.ToLower() != "{tab}" && _controlName1.ToLower() != "{right}")
                                                    System.Console.WriteLine("uiautomationsyncfusionpane]->Wrong value in French value column of structure sheet");
                                                setcellvaleps(rowval, colval, offsetval, dataval, _controlName1);
                                            }
                                        }
                                        break;
                                    case "uiautomationinfratable":
                                    case "uinfratable":
                                        AutomationElement infratable = GetUIAutomationInfraTableFlat(_searchBy, _controlName, _index);
                                        //   syncfusionpane.SetFocus();this mehtod dud not work hence using clickable point
                                        Console.WriteLine("[AddData][uiautomationsyncfusionpane]:-->before trying getclick");
                                        ClickControl(infratable);
                                        break;

                                    case "uiainfratablerow":
                                    case "uinfratablerow":
                                        if (Convert.IsDBNull(_controlName) == true || _controlName == "")
                                        {
                                            _controlName = _controlValue;
                                            logTofile(_eLogPtah, "[AddData]->[uiainfratablerow]: triyng to find infra row");
                                            AutomationElement infratablerow = GetUIAutomationGroupInfraTableRow(_searchBy, _controlName, _index);
                                            InvokePattern pat = (InvokePattern)infratablerow.GetCurrentPattern(InvokePattern.Pattern);
                                            logTofile(_eLogPtah, "[AddData]->[uiainfratablerow]:found row now ...trying  invoke patterns ");
                                            pat.Invoke();
                                        }
                                        else
                                        {
                                            System.Console.WriteLine("[AddData]->[uiainfratablerow]->Arguments,controlname shud be blank but has value " + _controlName);
                                        }
                                        break;
                                    case "uiainfratablerowflat":
                                    case "uinfratablerowflat":
                                        if (Convert.IsDBNull(_controlName) == true || _controlName == "")
                                        {
                                            _controlName = _controlValue;
                                            logTofile(_eLogPtah, "[AddData]->[uiainfratablerowflat] triyng to find infra row");
                                            AutomationElement infratablerow = GetUIAutomationFlatInfraTableRow(_searchBy, _controlName, _index);
                                            InvokePattern pat = (InvokePattern)infratablerow.GetCurrentPattern(InvokePattern.Pattern);
                                            logTofile(_eLogPtah, "[AddData]->[uiainfratablerowflat]  found row now ...trying  invoke patterns ");
                                            pat.Invoke();
                                        }
                                        else
                                        {
                                            System.Console.WriteLine("[AddData]->[uiainfratablerowflat]: ->Arguments,controlname shud be blank but has value " + _controlName);
                                        }
                                        break;
                                    case "uiainfratablerowflatnumber":
                                    case "uinfratablerowflatnumber":
                                        if (Convert.IsDBNull(_controlName) == true || _controlName == "")
                                        {
                                            _controlName = _controlValue;
                                            logTofile(_eLogPtah, "[AddData]->[uiainfratablerowflatnumber] triyng to find infra row");
                                            if (Convert.ToInt32(_index) != 1)
                                            {
                                                AutomationElement infratablerow = GetUIAutomationFlatInfraTableRowByNumber(_searchBy, _controlName, _index);

                                                logTofile(_eLogPtah, "[AddData]->[uiainfratablerowflatnumbers]  found row with index as " + _controlName);
                                                InvokePattern pat = (InvokePattern)infratablerow.GetCurrentPattern(InvokePattern.Pattern);
                                                logTofile(_eLogPtah, "[AddData]->[uiainfratablerowflatnumbers]  found row now ...trying  invoke patterns ");
                                                pat.Invoke();
                                            }
                                            System.Windows.Forms.SendKeys.Flush();
                                            System.Windows.Forms.SendKeys.SendWait("{Down}");
                                            System.Windows.Forms.SendKeys.Flush();
                                            System.Windows.Forms.SendKeys.SendWait("{Up}");

                                        }
                                        else
                                        {
                                            System.Console.WriteLine("[AddData]->[uiainfratablerowflat]: ->Arguments,controlname shud be blank but has value " + _controlName);
                                        }
                                        break;
                                    /*   case "wpfdatepicker":
                                           if (_controlValue != DBNull.Value.ToString())
                                           {
                                               wpfapp.GetWPFDatePicker(_globalWindow, _searchBy, _controlName).SetValue(_controlValue);
                                           }
                                           break;

                                       case "wpftabitem":
                                           if (_controlValue != DBNull.Value.ToString())
                                           {
                                               wpfapp.GetWPFTabItem(_globalWindow, _searchBy, _controlName).Select();
                                           }
                                           break;

                                       case "wpftree":
                                           if (_controlValue != DBNull.Value.ToString())
                                           {
                                               wpfapp.GetWPFTreeViewWindow(_globalWindow, _searchBy, _controlName, _index).SetValue(_controlValue);
                                           }
                                           break; */
                                    case "uiautomationheader":
                                    case "uheader":
                                        if (_controlValue != DBNull.Value.ToString())
                                        {

                                            AutomationElement header1 = GetUIAutomationHeader(_searchBy, _controlName, _index);
                                            try
                                            {
                                                InvokePattern hinvoke = (InvokePattern)header1.GetCurrentPattern(InvokePattern.Pattern);
                                                hinvoke.Invoke();
                                            }
                                            catch (Exception e)
                                            {
                                                logTofile(_eLogPtah, "Execption" + e.Message.ToString());

                                            }
                                        }
                                        break;

                                    case "uiautomationheaderitem":
                                    case "uheaderitem":
                                        if (_controlValue != DBNull.Value.ToString())
                                        {

                                            AutomationElement headeritem = GetUIAutomationHeaderitem(_searchBy, _controlName, _index);
                                            try
                                            {
                                                switch (_controlValue.ToLower())
                                                {
                                                    case "1":
                                                        ClickControl(headeritem);
                                                        break;
                                                    case "l":
                                                        ClickControl(headeritem);
                                                        break;
                                                    case "r":
                                                        RightClickControl(headeritem);
                                                        break;
                                                    case "d":
                                                        DoubleClickControl(headeritem);
                                                        break;
                                                    default:
                                                        Console.WriteLine("No valid input provided for clicking headeritem");
                                                        break;
                                                }
                                            }
                                            catch (Exception e)
                                            {
                                                logTofile(_eLogPtah, "Execption" + e.Message.ToString());

                                            }
                                        }
                                        break;
                                    case "uicustomcalendarmatbal":
                                        {

                                            if (_controlValue.Length > 0)
                                            {
                                                AutomationElement showcalbutton = GetUIAutomationbutton(_searchBy, _controlName, _index);
                                                inputDateInCalendarControl1(showcalbutton, _controlValue);

                                            }
                                            break;
                                        }
                                    default:
                                        throw new Exception("[AddData]->[System.Windows.Automation.ControlType]:Not a valid control type.");

                                }
                                #endregion   ControlTypes
                            }
                        }
                    }
                    uilog.commitrow();
                    uilog.CreateCSVfile(_reportsPath, uiAfileName);
                    uilog.ClearDataTable();
                }

                #endregion recordsinexcel
            }
            catch (Exception ex)
            {
                //todo add logging comments
                logTofile(_eLogPtah, "Erroring Line number in [Adddata] " + GetStacktrace(ex).ToString());

                throw new Exception(_error + "[AddData]:" + System.Environment.NewLine + ex.Message);

            }
        }
 static Au3()
 {
     au3        = new AutoItX3Lib.AutoItX3();
     LastWindow = "";
 }
Example #10
0
 static Au3()
 {
     au3 = new AutoItX3Lib.AutoItX3();
 }