I need a bit a help to randomly select a radio button on an page to answer questions. I am doing some Selenium / Java / webdriver development and sort of new to this. Below is a some code to find the number of radio buttons. any help that someone could provide would be greatly appriciated. if anyone has a better way to accomplish this, don't be shy...

thanks...

driver.switchTo().defaultContent();
		driver.switchTo().frame("mainFrame");
		
		
		List<WebElement> radioButtons = driver.findElements(By.tagName("input"));
		
		for (WebElement radio: radioButtons){
			if (!radio.getAttribute("type").equals("hidden")) {
				log.info("I found the following number of radio buttons "+ radioButtons.size());
				
				}
		}
//		
//		WebElement selectAnswer = driver.findElement(By.tagName("input"));
//		selectAnswer.click();
	}

I'm only in this area to study some Java syntax but did you ever think about using an integer additive to randomize it? Just a thought...

if (helped == yes)
{
cout << "awesome";
}

else
{
cout << "sorry to waste your time";
}