This is a migrated thread and some comments may be shown as answers.

Radio button identification.

1 Answer 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
SD
Top achievements
Rank 1
SD asked on 02 Sep 2010, 04:57 AM
Hi, 
I've got the following radio button among other similar radio buttons on the same page: 
<input type="radio" value="green" name="outcome_LO"/>
I came with this query but it's quite expensive and takes a while to execute (That page has 18 radios)..Any suggestion for a more elegant solution ? 
HtmlInputRadioButton rr = (from b in Find.AllControls<HtmlInputRadioButton>() where b.Value.Equals("green") && b.Name.Equals("outcome_LO") select b).First();

rr.Check(
true, true);

1 Answer, 1 is accepted

Sort by
0
Wit
Top achievements
Rank 1
answered on 02 Sep 2010, 05:38 PM
You can use Xpath search for example:
HtmlInputRadioButton greenBtn = Find.ByXPath("\\input[@value='green'][@name='outcome_LO']")

I recommend browsing through examples in C:\Program Files\Telerik\WebAii Testing Framework 2010.2\Samples\. There's file called FindingElements.cs.

I hope this helps...
Tags
General Discussions
Asked by
SD
Top achievements
Rank 1
Answers by
Wit
Top achievements
Rank 1
Share this question
or