Radio button identification.

2 posts, 0 answers
  1. SD
    SD avatar
    62 posts
    Member since:
    Apr 2010

    Posted 01 Sep 2010 Link to this post

    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);
  2. Wit
    Wit avatar
    24 posts
    Member since:
    Jul 2010

    Posted 02 Sep 2010 Link to this post

    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...
Back to Top