Example #1
0
        private static void SelectHierarchyLocationField(string type, dynamic ID, string fieldID)
        {
            int levels = type.Count(f => f == ':') + 1;

            string[] hierarchyList = type.Split(':');
            //foreach (string incidentType in typeHierarchyList)
            //{
            //    log.Info(incidentType);
            //}

            //Loop n many times where n is the number of levels
            for (int i = 1; i <= levels; i++)
            {
                //if you are in the deepest level, click on the actual item and not the + sign
                //if not in the deepest level, click on +
                if (i == levels)
                {
                    //click on item
                    log.Info("Clicking on item type: " + hierarchyList[i - 1]);
                    //Scroll down to the item before clicking it
                    GeneralPage.ScrollDownDropDownList(ID.GenerateHierarchyLocationXPath(hierarchyList, i, levels, fieldID));
                    GeneralPage.ClickOnObject(ID.GenerateHierarchyLocationXPath(hierarchyList, i, levels, fieldID));
                }
                else
                {
                    //Click on + sign
                    log.Info("Clicking + sign for: " + hierarchyList[i - 1]);
                    GeneralPage.ClickOnObject(ID.GenerateHierarchyLocationXPath(hierarchyList, i, levels, fieldID));
                }
            }
        }