Hi guys,
I have a page with three questions with choices in radio buttons. I am trying to select the radio button randomly, but I my code is not working as I am expecting.
That clicks the last one. I noticed that every question has different number in the name, I am thinking about somehow track the loop and go back and click if different. Any help would be appreciated
/>/>
I have a page with three questions with choices in radio buttons. I am trying to select the radio button randomly, but I my code is not working as I am expecting.
for the first question: <input class="CommentRequired14256_0" type="radio" name="question_answer[14256]" value="42584" /> <span class="answerText">Answer1</span> <input class="CommentRequired14256_0" type="radio" name="question_answer[14256]" value="42585" /> <span class="answerText">Answer2</span> <input class="CommentRequired14256_0" type="radio" name="question_answer[14256]" value="42586" /> <span class="answerText">Answer3</span> for the second question: <input class="CommentRequired14259_0" type="radio" name="question_answer[14259]" value="42597" /> <span class="answerText">Answer1</span> <input class="CommentRequired14259_0" type="radio" name="question_answer[14259]" value="42598" /> <span class="answerText">Answer1</span> <input class="CommentRequired14259_0" type="radio" name="question_answer[14259]" value="42599" /> <span class="answerText">Answer1</span>
Dim num As Integer = 0 For Each curElement As HtmlElement In WebBrowser1.document.GetElementsByTagName("input") If curElement.Name.Contains("question_answer") Then If curElement.GetAttribute("type") = "radio" Then curElement.Focus() curElement.InvokeMember("Click") End If end if next
That clicks the last one. I noticed that every question has different number in the name, I am thinking about somehow track the loop and go back and click if different. Any help would be appreciated
