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