예제 #1
0
        private static IList <string> GetAllElements(By locator)
        {
            Element = GenericHelper.GetElement(locator);
            SelectElement select = new SelectElement(Element);

            return(select.Options.Select((x) => x.Text).ToList());
        }
예제 #2
0
 public static void CheckedCheckBox(By locator)
 {
     Element = GenericHelper.GetElement(locator);
     if (Element.GetAttribute("checked").Equals("false"))
     {
         Element.Click();
     }
 }
예제 #3
0
 public static void ClearTextBox(ArrayList locators)
 {
     foreach (By loc in locators)
     {
         Element = GenericHelper.GetElement(loc);
         Element.Clear();
     }
 }
예제 #4
0
 public static void ClickButton(By locator)
 {
     if (IsButtonEnabled(locator))
     {
         IWebElement element = GenericHelper.GetElement(locator);
         element.Click();
     }
     else
     {
         Console.WriteLine("A logging Button is disenabled");
     }
 }
예제 #5
0
        public static bool IsCheckBoxChecked(By locator)
        {
            Element = GenericHelper.GetElement(locator);
            string flag = Element.GetAttribute("checked");

            if (flag == null)
            {
                return(false);
            }
            else
            {
                return(flag.Equals("checked") || flag.Equals("true"));
            }
        }
예제 #6
0
        public static string GetButtonText(By locator)
        {
            IWebElement element = GenericHelper.GetElement(locator);
            string      text    = element.GetAttribute("value");

            if (text == null)
            {
                return(String.Empty);
            }
            else
            {
                return(text);
            }
        }
예제 #7
0
        public static void SelectElementByIndex(By locator, int index)
        {
            Element = GenericHelper.GetElement(locator);
            SelectElement select = new SelectElement(Element);

            if (index < select.Options.Count)
            {
                select.SelectByIndex(index);
            }
            else
            {
                string ex = "There is a problem with a SelectElementByIndex function, index bigger than a count of the List";
                Console.WriteLine(ex);
                throw new Exception(ex);
            }
        }
예제 #8
0
        public static void SelectElementByValue(By locator, string visbleElement)
        {
            Element = GenericHelper.GetElement(locator);
            SelectElement  select     = new SelectElement(Element);
            IList <string> allOptions = GetAllElements(locator);

            if (allOptions.Contains(visbleElement))
            {
                select.SelectByValue(visbleElement);
            }
            else
            {
                string ex = "There is a problem with a SelectElementByValue function, value not Found";
                Console.WriteLine(ex);
                throw new Exception(ex);
            }
        }
예제 #9
0
 public static void TypeinTextBox(By locator, string text)
 {
     Element = GenericHelper.GetElement(locator);
     Element.Clear();
     Element.SendKeys(text);
 }
 public static void ClickOnRadioButton(By locator)
 {
     Element = GenericHelper.GetElement(locator);    
     Element.Click();
 }
예제 #11
0
        private static bool IsButtonEnabled(By locator)
        {
            IWebElement element = GenericHelper.GetElement(locator);

            return(element.Enabled);
        }
예제 #12
0
 public static void ClickLink(By locator)
 {
     Element = GenericHelper.GetElement(locator);
     Element.Click();
 }