Пример #1
0
 public static void ClickOnOneRadioButton(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     _element.Click();
     //the above is just basically saying when you find the button i am looking for click on it
     //if you notice it is the same code we have been repeating
 }
Пример #2
0
        public static string GetButtonText(By locator)
        {
            _element = GenericClassHelper.GetElement(locator);

            //if (_element.GetAttribute("value") == null)
            //{
            //    return String.Empty;
            //}
            //else
            //{
            //    return _element.GetAttribute("value");
            //}

            //--NOTE - the above can be written as below



            //if (_element.GetAttribute("value") == null)
            //    return string.Empty;
            //return _element.GetAttribute("value");

            //-NOTE- the baove can be written as below


            return(_element.GetAttribute("value") ?? string.Empty);
        }
Пример #3
0
        //now what if the checkbox is pre-ticked. We need a "conditional statement" that says if "ticked leave it"
        public static bool IsCheckboxSelected(By locator)
        {
            _element = GenericClassHelper.GetElement(locator);
            string checkboxStatus = _element.GetAttribute("agree");

            if (checkboxStatus != null)
            {
                return(checkboxStatus.Equals("true") || checkboxStatus.Equals("checked"));
            }
            return(false);
        }
Пример #4
0
        public static bool IsRadioButtonSelected(By locator)
        {
            _element = GenericClassHelper.GetElement(locator);
            var radioButtonStatus = _element.GetAttribute("checked");

            if (radioButtonStatus != null) // this means check theradiobutton is not false and if it has been selected tell
            //us that true with code on the next line
            {
                return(radioButtonStatus.Equals(true) || radioButtonStatus.Equals("checked"));
            }

            return(false);// if it has not been check return it "that if has not being checked" and then click it
        }
Пример #5
0
 public static void ClickLink(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     _element.Click();
 }
Пример #6
0
 public static void GetExactRadioButton(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
 }
Пример #7
0
 public static void ClearTextBox(By locator)
 {
     element = GenericClassHelper.GetElement(locator);
     element.Clear();
 }
Пример #8
0
 public static void SendTextToTextbox(By locator, string text) //where wherever you find a textbox call this helper class
 {
     element = GenericClassHelper.GetElement(locator);
     element.SendKeys(text);
 }
Пример #9
0
 public static bool IsButtonEnabled(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     return(_element.Enabled);
     // this means click the buttonif "button is enabled
 }
Пример #10
0
 public static void SelectMenuButton(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     _element.Click();
     //the above is just basically saying when you find the button i am looking for click on it
 }