public void SaveElementAttributes(string appName, string menu, string menuItem, AutomationElement menuItemObj, string Item, int id, AutomationElement itemObj) { appName = appName.Replace(" ", "_").Replace(".", ""); menu = menu.Replace(" ", "_").Replace(".", ""); menuItem = menuItem.ToString().Replace(" ", "").Replace(".", "").Trim(); Item = Item.ToString().Replace(" ", "").Replace(".", "").Trim(); string controlType = ""; double X = 0, Y = 0; if (menuItemObj != null) { FlaUI.Core.Shapes.Point menuP = menuItemObj.Properties.ClickablePoint; X = menuP.X; Y = menuP.Y; controlType = menuItemObj.ControlType.ToString(); } double Xi = 0, Yi = 0; if (itemObj != null) { FlaUI.Core.Shapes.Point itemP = itemObj.Properties.ClickablePoint; Xi = itemP.X; Yi = itemP.Y; controlType = itemObj.ControlType.ToString(); } JObject temp = new JObject(); Utils utils = new Utils(); if (!objectDetails.Any()) { objectDetails[appName] = temp; objectDetails[appName][menu] = temp; objectDetails[appName][menu][menuItem] = new JObject(); objectDetails[appName][menu][menuItem]["_properties"] = utils.WriteProperties(--id, X, Y, menuItem, controlType); LocatedObjects.objectsDB.Add(id, menuItemObj); objectDetails[appName][menu][menuItem][Item] = new JObject(); objectDetails[appName][menu][menuItem][Item]["_properties"] = utils.WriteProperties(++id, Xi, Yi, Item, controlType); LocatedObjects.objectsDB.Add(id, itemObj); } else if (objectDetails[appName][menu][menuItem] == null) { objectDetails[appName][menu][menuItem] = temp; objectDetails[appName][menu][menuItem]["_properties"] = utils.WriteProperties(--id, X, Y, menuItem, controlType); LocatedObjects.objectsDB.Add(id, menuItemObj); objectDetails[appName][menu][menuItem][Item] = temp; objectDetails[appName][menu][menuItem][Item]["_properties"] = utils.WriteProperties(++id, Xi, Yi, Item, controlType); LocatedObjects.objectsDB.Add(id, itemObj); } else if (objectDetails[appName][menu][menuItem][Item] == null) { objectDetails[appName][menu][menuItem][Item] = temp; objectDetails[appName][menu][menuItem][Item]["_properties"] = utils.WriteProperties(id, Xi, Yi, Item, controlType); LocatedObjects.objectsDB.Add(id, itemObj); } }