Пример #1
0
        // ************ DATE 10/16/2020 ************
        // ***** IMPORTANT: All Click by ID will search an element and then click it.
        // ************ --------------- ************
        #region BY ID


        /// <summary>
        /// Finds the first element in the screen that matches the id criteria and then click it.
        /// </summary>
        /// <param name="id">Id to find the object</param>
        public static void ById(string id)
        {
            try
            {
                AppiumWebElement element = GetControl.ById(id);
                element.Click();
            }
            catch (Exception ex)
            {
                Assert.Fail("ClickById threw an exception: " + ex.Message);
            }
        }
Пример #2
0
 /// <summary>
 /// Finds the first element in the screen that matches the id criteria and then simulates typing text into the element.
 /// </summary>
 /// <param name="id">Id to find the object</param>
 /// <param name="text">Text to match a specific element</param>
 /// <param name="inputText">The text to type into the element.</param>
 public static void ById(string id, string text, string inputText)
 {
     try
     {
         var element = GetControl.ById(id, text);
         element.Clear();
         element.SendKeys(inputText);
     }
     catch (Exception ex)
     {
         Assert.Fail("InputById threw an exception: " + ex.Message);
     }
 }
Пример #3
0
        public static void CheckBox(string id, string text, bool check = true)
        {
            try
            {
                var checkbox = text.IsNullOrEmpty() ? GetControl.ById(id) : GetControl.ById(id, text);

                if (!checkbox.GetAttribute("checked").Contains("true"))
                {
                    checkbox.Click();
                }
            }
            catch (Exception ex)
            {
                Assert.Fail("VerifyCheckBox threw an exception: " + ex.Message);
            }
        }
Пример #4
0
        public static void Message(string id, string text)
        {
            try
            {
                var messageBox = GetControl.ById(id);
                if (messageBox.Text.Contains(text))
                {
                    return;
                }

                Assert.Fail("The message was not found");
            }
            catch (Exception ex)
            {
                Assert.Fail("VerifyMessage threw an exception: " + ex.Message);
            }
        }