/// <summary>
        /// Gets controls class applied on it
        /// </summary>
        /// <param name="viewName"></param>
        /// <param name="controlName"></param>
        /// <param name="waitTime"></param>
        /// <param name="dynamicVariable"></param>
        /// <returns></returns>
        public static string GetControlClassName(string viewName, string controlName, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "")
        {
            Logger.InsertLogLine("Get Control class Name - Control: " + controlName + " in View : " + viewName);
            string ClassName = null;
            Control control = PopulateControl(viewName, controlName, dynamicVariable);
            if (control.ControlZone == "Native")
            {
                xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
                xamlControl.WaitForControlExist(waitTime);
                ClassName = xamlControl.ClassName;
            }

            else if (control.ControlZone == "Web")
            {
                htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
                ClassName = htmlControl.ClassName;
            }
            else if (control.ControlZone == "DirectUI")
            {
                directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
                directUIControl.WaitForControlExist(waitTime);
                ClassName = directUIControl.ClassName;
            }
            return ClassName;
        }
 /// <summary>
 /// Gets text of available control on screen
 /// </summary>
 /// <param name="viewName"></param>
 /// <param name="controlName"></param>
 /// <param name="waitTime"></param>
 /// <param name="dynamicVariable"></param>
 /// <returns>string:control text</returns>
 public static string GetControlText(string viewName, string controlName, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "")
 {
     Logger.InsertLogLine("Get Control text - Control: " + controlName + " in View : " + viewName);
     Control control = PopulateControl(viewName, controlName, dynamicVariable);
     if (control.ControlZone == "Native")
     {
         xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
         return xamlControl.GetProperty(XamlControl.PropertyNames.Name).ToString();
     }
     else if (control.ControlZone == "Web")
     {
         htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
         return htmlControl.GetProperty(HtmlControl.PropertyNames.InnerText).ToString();
     }
     else if (control.ControlZone == "DirectUI")
     {
         directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
         directUIControl.WaitForControlExist(waitTime);
         return directUIControl.GetProperty(DirectUIControl.PropertyNames.Name).ToString();
     }
     else
     {
         return "controlzone is not identified";
     }
 }
        /// <summary>
        /// Gets children count of parent control
        /// </summary>
        /// <param name="viewName"></param>
        /// <param name="controlName"></param>
        /// <param name="waitTime"></param>
        /// <param name="dynamicVariable"></param>
        /// <returns></returns>
        public static string[] GetChildrenControlNames(string viewName, string controlName, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "")
        {
            Logger.InsertLogLine("Get Childreh controls Name- Control: " + controlName + " in View : " + viewName);
            UITestControlCollection children = new UITestControlCollection();
            Control control = PopulateControl(viewName, controlName, dynamicVariable);
            if (control.ControlZone == "Native")
            {
                xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
                xamlControl.WaitForControlExist(waitTime);
                children = xamlControl.GetChildren();
            }

            else if (control.ControlZone == "Web")
            {
                htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
                children = htmlControl.GetChildren();
            }
            else if (control.ControlZone == "DirectUI")
            {
                directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
                directUIControl.WaitForControlExist(waitTime);
                children = directUIControl.GetChildren();
            }

            string[] myList = new string[50];
            for (int i = 0; i < children.Count; i++)
            {
                myList[i] = children[i].Name;
            }
            return myList;
        }
        /// <summary>
        /// Gets controls in bitmap for comparison
        /// </summary>
        /// <param name="viewName"></param>
        /// <param name="controlName"></param>
        /// <param name="waitTime"></param>
        /// <param name="dynamicVariable"></param>
        /// <returns></returns>
        public static Bitmap GetControlBitmap(string viewName, string controlName, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "")
        {
            Logger.InsertLogLine("Get Control bitmap - Control: " + controlName + " in View : " + viewName);

            Control control = PopulateControl(viewName, controlName, dynamicVariable);
            if (control.ControlZone == "Native")
            {
                xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
                xamlControl.WaitForControlExist(waitTime);
                return GetControlBitmap(xamlControl);
            }

            else if (control.ControlZone == "Web")
            {
                htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
                return GetControlBitmap(htmlControl);
            }
            else if (control.ControlZone == "DirectUI")
            {
                directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
                directUIControl.WaitForControlExist(waitTime);
                return GetControlBitmap(directUIControl);
            }
            else
            {
                return GetControlBitmap(xamlAppWindow);
            }
        }
        /// <summary>
        /// Compares Control Image colors
        /// </summary>
        /// <param name="viewName"></param>
        /// <param name="controlName"></param>
        /// <param name="controlColor"></param>
        /// <param name="waitTime"></param>
        /// <param name="dynamicVariable"></param>
        /// <returns>true:if color matches; false:color mismatch</returns>
        public static bool CompareControlImageColor(string viewName, string controlName, Color controlColor, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "")
        {
            Logger.InsertLogLine("Compare Control Image color - Control: " + controlName + " in View : " + viewName + "Color" + controlColor.ToString());

            Control control = PopulateControl(viewName, controlName, dynamicVariable);
            UITestControl uiControl;
            if (control.ControlZone == "Native")
            {
                xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
                xamlControl.WaitForControlExist(waitTime);
                uiControl = xamlControl;
            }

            else if (control.ControlZone == "Web")
            {
                htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
                uiControl = htmlControl;
            }
            else if (control.ControlZone == "DirectUI")
            {
                directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
                directUIControl.WaitForControlExist(waitTime);
                uiControl = directUIControl;
            }
            else
            {
                uiControl = xamlAppWindow;
            }
            return CompareControlImageColor(uiControl, controlColor);
        }
        /// <summary>
        /// Gets children count of parent control
        /// </summary>
        /// <param name="viewName"></param>
        /// <param name="controlName"></param>
        /// <param name="waitTime"></param>
        /// <param name="dynamicVariable"></param>
        /// <returns></returns>
        public static int GetChildrenControlCount(string viewName, string controlName, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "")
        {
            Logger.InsertLogLine("Get Childreh control count- Control: " + controlName + " in View : " + viewName);
            int ChildrenCount = 0;
            Control control = PopulateControl(viewName, controlName, dynamicVariable);
            if (control.ControlZone == "Native")
            {
                xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
                xamlControl.WaitForControlExist(waitTime);
                ChildrenCount = xamlControl.GetChildren().Count;
            }

            else if (control.ControlZone == "Web")
            {
                htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
                ChildrenCount = htmlControl.GetChildren().Count;
            }
            else if (control.ControlZone == "DirectUI")
            {
                directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
                directUIControl.WaitForControlExist(waitTime);
                ChildrenCount = directUIControl.GetChildren().Count;
            }
            return ChildrenCount;
        }
        public static void ClickChildrensChildByNameAtFirstLevel(string viewName, string controlName, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "", string ChildName = "")
        {
            Control control = PopulateControl(viewName, controlName, dynamicVariable);
            Logger.InsertLogLine("Get Childreh control count- Control: " + controlName + " in View : " + viewName);
            Logger.InsertLogLine("Click on children's child: " + ChildName + "in control: " + control.ControlName + " in View : " + viewName);
            UITestControlCollection children = new UITestControlCollection();
            if (control.ControlZone == "Native")
            {
                xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
                xamlControl.WaitForControlExist(waitTime);
                children = xamlControl.GetChildren();
            }

            else if (control.ControlZone == "Web")
            {
                htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
                children = htmlControl.GetChildren();
            }
            else if (control.ControlZone == "DirectUI")
            {
                directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
                directUIControl.WaitForControlExist(waitTime);
                children = directUIControl.GetChildren();
            }

            for (int j = 0; j < children.Count; j++)
            {
                string chname = children[j].Name;

                if (children[j].Name.Contains(ChildName))
                {
                    Gesture.Tap(new Point(children[j].BoundingRectangle.X + children[j].BoundingRectangle.Width / 2, children[j].BoundingRectangle.Y + children[j].BoundingRectangle.Height / 2));
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="viewName"></param>
        /// <param name="controlName"></param>
        /// <param name="waitTime"></param>
        /// <param name="dynamicVariable"></param>
        /// <returns></returns>
        public static bool VerifyControlHighlighted(string viewName, string controlName, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "")
        {
            Logger.InsertLogLine("Verify Control highlighted - Control: " + controlName + " in View : " + viewName);
            bool ControlHasFocus = false;
            Control control = PopulateControl(viewName, controlName, dynamicVariable);
            if (control.ControlZone == "Native")
            {
                xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
                xamlControl.WaitForControlExist(waitTime);
                ControlHasFocus = xamlControl.HasFocus;
            }

            else if (control.ControlZone == "Web")
            {
                htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
                ControlHasFocus = htmlControl.HasFocus;
            }
            else if (control.ControlZone == "DirectUI")
            {
                directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
                directUIControl.WaitForControlExist(waitTime);
                ControlHasFocus = directUIControl.HasFocus;
            }
            return ControlHasFocus;
        }
        public static bool VerifyChildrensChildControlByName(string viewName, string controlName, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "", string ChildName = "")
        {
            Logger.InsertLogLine("Get Childreh control count- Control: " + controlName + " in View : " + viewName);
            UITestControlCollection children = new UITestControlCollection();
            Control control = PopulateControl(viewName, controlName, dynamicVariable);
            if (control.ControlZone == "Native")
            {
                xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
                xamlControl.WaitForControlExist(waitTime);
                children = xamlControl.GetChildren();
            }

            else if (control.ControlZone == "Web")
            {
                htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
                children = htmlControl.GetChildren();
            }
            else if (control.ControlZone == "DirectUI")
            {
                directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
                directUIControl.WaitForControlExist(waitTime);
                children = directUIControl.GetChildren();
            }

            for (int i = 0; i < children.Count; i++)
            {
                string chname = children[i].Name;

                UITestControlCollection children1 = new UITestControlCollection();

                children1 = children[i].GetChildren();

                for (int j = 0; j < children.Count; j++)
                {
                    string chchname = children1[j].Name;
                    if (children1[j].Name.Contains(ChildName))
                    {
                        return true;
                    }
                }
            }

            return false;
        }
        public static bool VerifyChildByName(string viewName, string controlName, string childName, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "")
        {
            bool exists = false;
            UITestControlCollection children = null;
            UITestControl child = null;
            Control control = PopulateControl(viewName, controlName, dynamicVariable);
            if (control.ControlZone == "Native")
            {
                xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
                xamlControl.WaitForControlExist(waitTime);
                children = xamlControl.GetChildren();
            }

            else if (control.ControlZone == "Web")
            {
                htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
                children = htmlControl.GetChildren();
            }
            else if (control.ControlZone == "DirectUI")
            {
                directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
                directUIControl.WaitForControlExist(waitTime);
                children = directUIControl.GetChildren();
            }
            for (int i = 0; i < children.Count; i++)
            {
                child = children[i];
                string name = child.GetProperty("Name").ToString();
                if (name.Contains(childName))
                {
                    exists = true;
                }
            }
            return exists;
        }
        public static void ClickAndVerifyColorOfChildrenByInstance(string viewName, string controlName, Color samplecolor, out bool ColorCompareResult, int waitTime = WaitTime.DefaultWaitTime, string dynamicVariable = "", int ChildInstance = 1)
        {
            ColorCompareResult = false;
            Control control = PopulateControl(viewName, controlName, dynamicVariable);
            Logger.InsertLogLine("Get Childreh control count- Control: " + controlName + " in View : " + viewName);
            Logger.InsertLogLine("Click on children's child: " + ChildInstance.ToString() + "in control: " + control.ControlName + " in View : " + viewName);
            UITestControlCollection children = new UITestControlCollection();
            if (control.ControlZone == "Native")
            {
                xamlControl = GetXamlControl(control, dynamicVariable, waitTime);
                xamlControl.WaitForControlExist(waitTime);
                children = xamlControl.GetChildren();
            }

            else if (control.ControlZone == "Web")
            {
                htmlControl = GetHtmlControl(control, dynamicVariable, waitTime);
                children = htmlControl.GetChildren();
            }
            else if (control.ControlZone == "DirectUI")
            {
                directUIControl = GetDirectUIControl(control, dynamicVariable, waitTime);
                directUIControl.WaitForControlExist(waitTime);
                children = directUIControl.GetChildren();
            }

            for (int j = 0; j < children.Count; j++)
            {
                if (j == ChildInstance - 1)
                {
                    UITestControl uicontrol = children[j];
                    ColorCompareResult = CompareControlImageColor(uicontrol, samplecolor);
                    Gesture.Tap(new Point(children[j].BoundingRectangle.X + children[j].BoundingRectangle.Width / 2, children[j].BoundingRectangle.Y + children[j].BoundingRectangle.Height / 2));
                }
            }
        }