private static IList <string> GetAllElements(By locator) { Element = GenericHelper.GetElement(locator); SelectElement select = new SelectElement(Element); return(select.Options.Select((x) => x.Text).ToList()); }
public static void CheckedCheckBox(By locator) { Element = GenericHelper.GetElement(locator); if (Element.GetAttribute("checked").Equals("false")) { Element.Click(); } }
public static void ClearTextBox(ArrayList locators) { foreach (By loc in locators) { Element = GenericHelper.GetElement(loc); Element.Clear(); } }
public static void ClickButton(By locator) { if (IsButtonEnabled(locator)) { IWebElement element = GenericHelper.GetElement(locator); element.Click(); } else { Console.WriteLine("A logging Button is disenabled"); } }
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")); } }
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); } }
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); } }
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); } }
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(); }
private static bool IsButtonEnabled(By locator) { IWebElement element = GenericHelper.GetElement(locator); return(element.Enabled); }
public static void ClickLink(By locator) { Element = GenericHelper.GetElement(locator); Element.Click(); }