Example #1
0
        static void EnterText(string marked, int index, string text)
        {
            Xamarin.UITest.Desktop.AppResult textField = null;
            var safeIndex  = Math.Max(index, 0);
            var textFields = _cocoaApp.QueryById(marked).Where((arg) => arg.Class.Contains("SearchField") || arg.Class.Contains("TextField"));

            if (textFields.Count() > 0)
            {
                textField = textFields.ElementAt(safeIndex);
            }
            else
            {
                var markedField = _cocoaApp.QueryById(marked);
                if (markedField.Length > 0)
                {
                    textField = markedField[0];
                }
                else
                {
                    var allTextFields = _cocoaApp.QueryByType("TextField");
                    textField = allTextFields[0];
                }
            }

            if (textField != null)
            {
                EnterText(text, textField.Rect.CenterX, textField.Rect.CenterY);
            }
        }
Example #2
0
 public static Xamarin.UITest.Queries.AppResult ToUITestResult(this Xamarin.UITest.Desktop.AppResult result)
 {
     return(new Xamarin.UITest.Queries.AppResult
     {
         Id = result.Id ?? result.TestId,
         Label = result.Label,
         Text = result.Text ?? result.Value,
         Enabled = result.Enabled,
         Class = result.Class,
         Rect = new Xamarin.UITest.Queries.AppRect
         {
             X = result.Rect.X,
             Y = result.Rect.Y,
             Width = result.Rect.Width,
             Height = result.Rect.Height,
             CenterX = result.Rect.CenterX,
             CenterY = result.Rect.CenterY
         }
     });
 }