// ************ DATE 10/16/2020 ************ // ***** IMPORTANT: All Click by UIAUTOMATOR will search an element and then click it. // ************ --------------- ************ #region BY UIAUTOMATOR /// <summary> /// Finds the first element in the screen that matches the UiAutomator criteria and click it. /// </summary> /// <param name="attribute">All the possible attributes that an element has, like text</param> /// <param name="value">The value to match with the attribute</param> public static void ByUiAutomator(string attribute, string value) { try { var element = GetControl.ByUiAutomator(attribute, value); element.Click(); } catch (Exception ex) { Assert.Fail("ClickByUiAutomator threw an exception: " + ex.Message); } }
// ************ DATE 10/16/2020 ************ // ***** IMPORTANT: All Input by UIAUTOMATOR will search an element and then simulates typing text into the element. // ************ --------------- ************ #region BY UIAUTOMATOR /// <summary> /// Finds the first element in the screen that matches the UiAutomator criteria and then simulates typing text into the element. /// </summary> /// <param name="inputText">The text to type into the element.</param> /// <param name="attribute">All the possible attributes that an element has, like text</param> /// <param name="value">The value to match with the attribute</param> public static void ByUiAutomator(string inputText, string attribute, string value) { try { var element = GetControl.ByUiAutomator(attribute, value); element.Clear(); element.SendKeys(inputText); } catch (Exception ex) { Assert.Fail("InputByUiAutomator threw an exception: " + ex.Message); } }