Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public static bool IsRadioButtonSelected(By locator)
        {
            _element = GenericClassHelper.GetElement(locator);
            var radioButtonStatus = _element.GetAttribute("checked");

            if (radioButtonStatus != null)                                                       //check the radio button is not null.That is, it is selected
            {
                return(radioButtonStatus.Equals("true") || radioButtonStatus.Equals("checked")); //if it
                //has been checked return the value, if not check it
            }
            return(false);
        }
Esempio n. 3
0
        public static void GetExactradioButton(By locator)
        {
            _element = GenericClassHelper.GetElement(locator);
            IList <IWebElement> radio = _element.FindElements(By.TagName("input"));

            foreach (var radioOption in radio)
            {
                if (radioOption.GetAttribute("value").Equals("0"))
                {
                    radioOption.Click();
                }
            }
        }
Esempio n. 4
0
        public static string GetButtonText(By locator)
        {
            _element = GenericClassHelper.GetElement(locator);
            //if (_element.GetAttribute("value") == null)
            //{
            //    return String.Empty;
            //}
            //else
            //{
            //    return _element.GetAttribute("value"); //here "value" is "Continue"
            //}

            //we can write the above as below
            //if (_element.GetAttribute("value") == null)
            //    return string.Empty;
            //return _element.GetAttribute("value");

            //we can also write the above as below
            return(_element.GetAttribute("value") ?? string.Empty);
        }
Esempio n. 5
0
 public static void ClickLink(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     _element.Click();
 }
Esempio n. 6
0
 public static void ClearTextBox(By locator)
 {
     element = GenericClassHelper.GetElement(locator);
     element.Clear();
 }
Esempio n. 7
0
 public static void SendTextToTextbox(By locator, string text)
 {
     element = GenericClassHelper.GetElement(locator);
     element.SendKeys(text);
 }
Esempio n. 8
0
 public static bool IsButtonEnabled(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     return(_element.Enabled); //this check if the button is visible but grey out
 }
Esempio n. 9
0
 public static void SelectMenuButton(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     _element.Click();
 }
Esempio n. 10
0
 public static void ClickOneRadiobutton(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     _element.Click();
 }