我有这样的HTML选择单选按钮中的硒的webdriver [C#]
<div class="Radio">
<label>
<input class id="checkbox" name="category" type="radio" value="1">
<strong> TONY STARK </strong>
</label>
<label>
<input class id="checkbox" name="category" type="radio" value="2">
<strong> IRON MAN </strong>
</label>
<label>
<input class id="checkbox" name="category" type="radio" value="3">
<strong> ROBERT DOWNEY </strong>
</label>
我需要基于TONY STARK
,IRON MAN
,ROBERT DOWNEY
作为用户并将其作为柔性参数
I选择单选按钮尝试过,但任何其他简单的方法肯定会帮助我!
driver.FindElement(By.Id("checkbox"));
for(WebElement radiobutton: radiobuttons)
{
if(radiobutton.getAttribute("value").equals("TONY STARK"))
radiobutton.click();
}
太棒了,完成了!所以,@沙拉布,我如何通过**'value' **找到文本? – cashanzlo
我很抱歉,但我不明白你在问什么?你想通过哪个值找到文本? –