I have google around a bit trying to finds some way you can click check boxes by entering a value, similar what you can use to select values in Drop Down List. But havent found a way yet.
I have two check boxes with Yes and No
div class="radio">
<label>
<input type="radio" name="LongTermContract" value="Yes" autocomplete="off" checked="">Yes
</label>
<label>
<input type="radio" name="LongTermContract" value="No" autocomplete="off">No </label>
</div>
I'm also using PageObjects,
[FindsBy(How = How.Name, Using = "LongTermContract")]
public IWebElement radioBtnLongTermContract { get; set; }
This is the Method I have.
public static void SelectOptions(this IWebElement element, string value)
{
PropertiesCollection.driver.FindElement(By.XPath("//input[@value='" + value + "']")).Click();
}
Now if im trying this
public void SelectValue(){
Reporting("NO");
}
I get an error that it does not find the element
Additional information: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@value='NO']"}
Any ideas tips?