Пример #1
0
        public static Ranorex.Row GetRowInPropertiesPanelGivenPath(string pathItem, Adapter argumentAdapter)
        {
            Mouse.DefaultMoveTime        = 0;
            Keyboard.DefaultKeyPressTime = 0;
            Delay.SpeedFactor            = 0.0;
            int minimumIndex  = 0;
            var stepsPathItem = pathItem.Split('>').ToList();

            Ranorex.Row stepRow = argumentAdapter.As <Table>().Rows.ToList()[1];
            for (int i = 0; i < stepsPathItem.Count; i++)
            {
                // Find the item corresponding to the step
                var step         = stepsPathItem[i];
                var completeList = argumentAdapter.As <Table>().Rows.ToList();
                var searchList   = completeList.GetRange(minimumIndex, completeList.Count - minimumIndex);
                var kk           = searchList.Where(rw => rw.GetAttributeValue <string>("AccessibleName").Contains(step));
                var kk2          = searchList.Select(rw => rw.GetAttributeValue <string>("AccessibleName"));
                var indexStepRow = searchList.FindIndex(rw => rw.GetAttributeValue <string>("AccessibleName").Contains(step));
                stepRow = searchList[indexStepRow];
                stepRow.Focus();
                stepRow.Select();
                if (i != stepsPathItem.Count - 1 && stepRow.Element.GetAttributeValueText("AccessibleState").Contains("Collapsed"))
                {
                    stepRow.PressKeys("{Right}");
                }
                minimumIndex += 1 + indexStepRow;
            }
            return(stepRow);
        }
Пример #2
0
        public Ranorex.Row GetRowInPropertiesPanelGivenPath(Adapter argumentAdapter, string pathItem)
        {
            int minimumIndex  = 0;
            var stepsPathItem = pathItem.Split('>').ToList();

            Ranorex.Row stepRow = argumentAdapter.As <Table>().Rows.ToList()[1];
            for (int i = 0; i < stepsPathItem.Count; i++)
            {
                // Find the item corresponding to the step
                var step         = stepsPathItem[i];
                var completeList = argumentAdapter.As <Table>().Rows.ToList();
                var searchList   = completeList.GetRange(minimumIndex, completeList.Count - minimumIndex);
                var indexStepRow = searchList.FindIndex(rw => rw.GetAttributeValue <string>("AccessibleName").Contains(step));
                stepRow = searchList[indexStepRow];
                // if step is intermediate
                if (i != stepsPathItem.Count - 1)
                {
                    var stateStepRow = stepRow.Element.GetAttributeValueText("AccessibleState");
                    // if intermediate step is collapsed
                    if (stateStepRow.Contains("Collapsed"))
                    {
                        // Select and expand the intermediate item
                        Report.Log(ReportLevel.Info, "was collapsed");
                        stepRow.Focus();
                        stepRow.Select();
                        stepRow.PressKeys("{Right}");
                    }
                }
                else
                {
                    // Select the final item
                    stepRow.Focus();
                    stepRow.Select();
                }
                // Update the minimum index administration (only search forward)
                minimumIndex += 1 + indexStepRow;
            }
            return(stepRow);
        }