示例#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);
        }
        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);
        }
        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();
                }
            }
        }
示例#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);
        }
示例#5
0
 public static void ClickLink(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     _element.Click();
 }
示例#6
0
 public static void ClearTextBox(By locator)
 {
     element = GenericClassHelper.GetElement(locator);
     element.Clear();
 }
示例#7
0
 public static void SendTextToTextbox(By locator, string text)
 {
     element = GenericClassHelper.GetElement(locator);
     element.SendKeys(text);
 }
示例#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
 }
示例#9
0
 public static void SelectMenuButton(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     _element.Click();
 }
示例#10
0
 public static void ClickOneRadiobutton(By locator)
 {
     _element = GenericClassHelper.GetElement(locator);
     _element.Click();
 }