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(); } } }
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); }
public static void ClickLink(By locator) { _element = GenericClassHelper.GetElement(locator); _element.Click(); }
public static void ClearTextBox(By locator) { element = GenericClassHelper.GetElement(locator); element.Clear(); }
public static void SendTextToTextbox(By locator, string text) { element = GenericClassHelper.GetElement(locator); element.SendKeys(text); }
public static bool IsButtonEnabled(By locator) { _element = GenericClassHelper.GetElement(locator); return(_element.Enabled); //this check if the button is visible but grey out }
public static void SelectMenuButton(By locator) { _element = GenericClassHelper.GetElement(locator); _element.Click(); }
public static void ClickOneRadiobutton(By locator) { _element = GenericClassHelper.GetElement(locator); _element.Click(); }