I'm trying to set up a Selenium test of a page and can't get it to click on radio buttons
I'm trying to use the IWebDriver xpath method
<fieldset class="radio-button-list">
<label >
<span class="className">Text1</span>
<input type="radio" value="Button1">
</label>
<label>
<span class="className">Text2</span>
<input type="radio" value="Button2">
</label>
</fieldset>
This is what I'm using...
driver.FindElement(By.XPath("//button[contains(text(),'Text2')]")).Click();
I expect it to click on the radio button but I'm getting this error:
OpenQA.Selenium.NoSuchElementException: 'no such element: Unable to locate element: {"method":"xpath","selector":"//button[contains(text(),'Text2')]"}