Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Clicking specific radio button on web form and if statement

[CODE]Dim PageInput2 As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("select")
For Each elem As HtmlElement In PageInput2
If elem.GetAttribute("id") = "adults" Then
elem.SetAttribute("value", AdultsTXT.Text)
End If
If elem.GetAttribute("id") = "children" Then
elem.SetAttribute("value", ChildrenTXT.Text)
End If
If elem.GetAttribute("id") = "infants" Then
elem.SetAttribute("value", InfantsTXT.Text)
End If
If elem.GetAttribute("id") = "wdftime1" Then
elem.SetAttribute("value", Time1TXT.Text)
End If
If elem.GetAttribute("id") = "wdftime2" Then
elem.SetAttribute("value", Time2TXT.Text)
End If
Next
Dim PageInput3 As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("checked")
For Each elem As HtmlElement In PageInput3
If elem.GetAttribute("id") = "oneway" Then
elem.SetAttribute("value", RadioButton1.Checked)
End If
If elem.GetAttribute("id") = "return" Then
elem.SetAttribute("value", RadioButton2.Checked)
End If
Next[/CODE]

What I'm trying to do is have my vb.net program to enter information that is put into the form, to place it on a website. The first problem I'm having is trying to make the radio buttons to click the radio on the website. I'm thinking that the "checked" is probably the wrong piece. So if anyone knew which one that should be changed to, that'd be great to let me know. When I look into the line of HTML and it's tags for the radio buttons I'm aimed at, it looks like this.

[CODE] 
 
[/CODE]

I was thinking select might work, but it hasn't so far. That or my 'round trip' radio button isn't correct in what it's aimed at since the Round Trip radio on the website seems to look like a if statement but still retains the same kind of idea with One way. So I'm not sure how to address that.
My second problem is that because of the radio buttons, I'm not sure how one would if statement them so that if it does a one way. By how it seems, the website hides the second set of fields for returns on a round trip. So my form is automatically entering default calendar return. What is making me say I'm not sure how it would be done is because if you put the if statement under one of the WebBrowser1.Document.GetElementsByTagName(""), then the field probably wouldn't function properly.

Any ideas? Tutorials and resources would be most appreciated.
Sign In or Register to comment.