select radio button by index
<p>I am using C# selenium driver in visual studio for automating my scripts.The data in my radio button gets dynamically generated and I want to select the radio button using index . These are the ways I tried </p>

<p><strong>Method 1</strong></p>

<pre><code>new SelectElement(driver.FindElement(By.Id("XX"))).SelectByIndex(2);Click();
</code></pre>

<p>In first method , I am not able to relate the Click to the element</p>

<p><strong>Method 2</strong></p>

<pre><code>IWebElement element = driver.FindElement(By.("XX"));
System.Threading.Thread.Sleep(2000);
element.Click();
</code></pre>

<p>In method 2 , I am not sure how to pass the index.</p>

<p>This is my HTML code :</p>

<pre><code>&lt;input type="radio" name="XXXX" id="XXXX" value="5273786"&gt;.
</code></pre>

<p>So These radio buttons get dynamically generated. For eg, if I have 3 radio buttons, <strong>all 3 radio buttons have the same id and name but a different value</strong>. </p>

<p>So it would be great if you could let me know <strong>how to select the first radio button by passing its value or by selecting the radio button using index</strong>.</p>