Reputation: 1
I am using Selenium 2.0 for C# to find a radio button and click it. The code is as below:
IWebElement t = driver.FindElement(By.XPath("//table[@id='ctl00_Main__objObjectivesFeedback_ctl39']/tbody/tr/td[2]/input[@type='radio']"));
t.Click();
If I do a Console.Write(t.GetAttribute("name"))
, it returns the correct element name, however, click does not work.
Btw, I am using FireFox 3.6.20.
Upvotes: 0
Views: 691
Reputation: 12806
Try
t.SendKeys(Keys.Space);
If it works the only downside is SendKeys
does not wait for the page to finish loading if the event caused the page to reload. Usually not a problem for radio buttons but it's something to keep in mind.
Upvotes: 2