public static void ClickOnOneRadioButton(By locator) { _element = GenericClassHelper.GetElement(locator); _element.Click(); //the above is just basically saying when you find the button i am looking for click on it //if you notice it is the same code we have been repeating }
public static string GetButtonText(By locator) { _element = GenericClassHelper.GetElement(locator); //if (_element.GetAttribute("value") == null) //{ // return String.Empty; //} //else //{ // return _element.GetAttribute("value"); //} //--NOTE - the above can be written as below //if (_element.GetAttribute("value") == null) // return string.Empty; //return _element.GetAttribute("value"); //-NOTE- the baove can be written as below return(_element.GetAttribute("value") ?? string.Empty); }
//now what if the checkbox is pre-ticked. We need a "conditional statement" that says if "ticked leave it" 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) // this means check theradiobutton is not false and if it has been selected tell //us that true with code on the next line { return(radioButtonStatus.Equals(true) || radioButtonStatus.Equals("checked")); } return(false);// if it has not been check return it "that if has not being checked" and then click it }
public static void ClickLink(By locator) { _element = GenericClassHelper.GetElement(locator); _element.Click(); }
public static void GetExactRadioButton(By locator) { _element = GenericClassHelper.GetElement(locator); }
public static void ClearTextBox(By locator) { element = GenericClassHelper.GetElement(locator); element.Clear(); }
public static void SendTextToTextbox(By locator, string text) //where wherever you find a textbox call this helper class { element = GenericClassHelper.GetElement(locator); element.SendKeys(text); }
public static bool IsButtonEnabled(By locator) { _element = GenericClassHelper.GetElement(locator); return(_element.Enabled); // this means click the buttonif "button is enabled }
public static void SelectMenuButton(By locator) { _element = GenericClassHelper.GetElement(locator); _element.Click(); //the above is just basically saying when you find the button i am looking for click on it }