Example #1
0
 /// <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="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 ByUiAutomatorSingleSelector(Share.Selector selector, string text, int position = 0)
 {
     try
     {
         var element = GetControl.ByUiAutomatorSingleSelector(selector, text, position);
         element.Click();
     }
     catch (Exception ex)
     {
         Assert.Fail("ClickByUiAutomatorSingleSelector threw an exception: " + ex.Message);
     }
 }
Example #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 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="position"> position of an object on the layout hierarchy </param>
        public static void ByUiAutomatorSingleSelector(string inputText, Share.Selector selector, bool value, int position = 0)
        {
            try
            {
                var element = GetControl.ByUiAutomatorSingleSelector(selector, value, position);
                element.Clear();
                element.SendKeys(inputText);
            }
            catch (Exception ex)
            {
                Assert.Fail("InputByUiAutomatorSingleSelector threw an exception: " + ex.Message);
            }
        }