示例#1
0
 /// <summary>
 /// Finds the first element in the screen that matches the UiAutomator criteria using a Parent UiSelector and click it.
 /// </summary>
 /// <param name="selector"> Represents the Enum in Share class </param>
 /// <param name="text"> the partial/complete text of an element to be found </param>
 /// <param name="position"> position of an object on the layout hierarchy </param>
 public static void ByUiAutomatorParentSelector(Share.Selector selector, string text, int position = 0)
 {
     try
     {
         var element = GetControl.ByUiAutomatorParentSelector(selector, text, position);
         element.Click();
     }
     catch (Exception ex)
     {
         Assert.Fail("ClickByUiAutomatorParentSelector threw an exception: " + ex.Message);
     }
 }
示例#2
0
        // ************ DATE 10/16/2020 ************
        // All the possible Selectors to search for a single element till date.
        // ************ --------------- ************
        #region USING SINGLE SELECTORS


        /// <summary>
        /// Finds the first element in the screen that matches the UiAutomator criteria using a UiSelector and click it.
        /// </summary>
        /// <param name="selector"> Represents the Enum in Share class </param>
        /// <param name="value"> the boolean value of an element to be found </param>
        /// <param name="position"> position of an object on the layout hierarchy </param>
        public static void ByUiAutomatorSingleSelector(Share.Selector selector, bool value, int position = 0)
        {
            try
            {
                var element = GetControl.ByUiAutomatorSingleSelector(selector, value, position);
                element.Click();
            }
            catch (Exception ex)
            {
                Assert.Fail("ClickByUiAutomatorSingleSelector threw an exception: " + ex.Message);
            }
        }
示例#3
0
 /// <summary>
 /// Finds the first element in the screen that matches the UiAutomator criteria using a Parent UiSelector and then simulates typing text into the element.
 /// </summary>
 /// <param name="inputText">The text to type into the element.</param>
 /// <param name="selector"> Represents the Enum in Share class </param>
 /// <param name="text"> the partial/complete text of an element to be found </param>
 /// <param name="position"> position of an object on the layout hierarchy </param>
 public static void ByUiAutomatorParentSelector(string inputText, Share.Selector selector, string text, int position = 0)
 {
     try
     {
         var element = GetControl.ByUiAutomatorParentSelector(selector, text, position);
         element.Clear();
         element.SendKeys(inputText);
     }
     catch (Exception ex)
     {
         Assert.Fail("InputByUiAutomatorParentSelector threw an exception: " + ex.Message);
     }
 }
示例#4
0
        // ************ DATE 10/16/2020 ************
        // All the possible Selectors to search for a child element till date.
        // ************ --------------- ************
        #region USING CHILD SELECTORS


        /// <summary>
        /// Finds the first element in the screen that matches the UiAutomator criteria using a Child UiSelector and then simulates typing text into the element.
        /// </summary>
        /// <param name="inputText">The text to type into the element.</param>
        /// <param name="selector"> Represents the Enum in Share class </param>
        /// <param name="value"> the boolean value of an element to be found </param>
        /// <param name="text"> text to found the element</param>
        /// <param name="position"> position of an object on the layout hierarchy </param>
        public static void ByUiAutomatorChildSelector(string inputText, Share.Selector selector, bool value, string text, int position = 0)
        {
            try
            {
                var element = GetControl.ByUiAutomatorChildSelector(selector, value, position);
                element.Clear();
                element.Click();
            }
            catch (Exception ex)
            {
                Assert.Fail("InputByUiAutomatorChildSelector threw an exception: " + ex.Message);
            }
        }
示例#5
0
 /// <summary>
 /// Finds a collection of elements in the screen that matches the UiAutomator criteria using a Parent UiSelector.
 /// </summary>
 /// <param name="selector"> Represents the Enum in Share class </param>
 /// <param name="value"> the boolean value of an element to be found </param>
 /// <param name="position"> position of an object on the layout hierarchy </param>
 public static void CollectionByUiAutomatorParentSelector(Share.Selector selector, bool value, string text, int position = 0)
 {
     try
     {
         var elements = GetControl.CollectionByUiAutomatorParentSelector(selector, value, position);
         foreach (var element in elements)
         {
             if (element.Text.Contains(text))
             {
                 element.Click();
             }
         }
     }
     catch (Exception ex)
     {
         Assert.Fail("ClicksCollectionByUiAutomatorParentSelector threw an exception: " + ex.Message);
     }
 }
示例#6
0
 /// <summary>
 /// Finds a collection of elements in the screen that matches the UiAutomator criteria using a Child UiSelector.
 /// </summary>
 /// <param name="inputText">The text to type into the element.</param>
 /// <param name="selector"> Represents the Enum in Share class </param>
 /// <param name="value"> the boolean value of an element to be found </param>
 /// <param name="text"> text to found the element to be Input</param>
 /// <param name="position"> position of an object on the layout hierarchy </param>
 public static void CollectionByUiAutomatorChildSelector(string inputText, Share.Selector selector, bool value, string text, int position = 0)
 {
     try
     {
         var elements = GetControl.CollectionByUiAutomatorChildSelector(selector, value, position);
         foreach (var element in elements)
         {
             if (element.Text.Contains(text))
             {
                 element.Clear();
                 element.SendKeys(inputText);
             }
         }
     }
     catch (Exception ex)
     {
         Assert.Fail("InputCollectionByUiAutomatorChildSelector threw an exception: " + ex.Message);
     }
 }