|
-
Mar 26th, 2010, 07:28 PM
#1
Thread Starter
Lively Member
[Resolved]Entering text into a webbrowser field.
Hi, I want to make it so I have a form and a button and a web browser.
The web browser will automatically load to a website that has boxes to fill in.
In google chrome when i right click on the text box i can find the element or whatever its called.
I am just wondering how I can make it so when I press the button it will change the text of the textbox on the website to whatever I want.
Also how to make it press a button on a web browser as well.
(All of this while the browser is invisible)
Thanks for the help!
Last edited by WookieVagina; Mar 26th, 2010 at 10:01 PM.
Reason: Resolved.
-
Mar 26th, 2010, 07:38 PM
#2
Re: Entering text into a webbrowser field.
can you tell me the url you're talking about?
it'll help to see the html, because no 2 webpages are the same
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 26th, 2010, 07:47 PM
#3
Thread Starter
Lively Member
Re: Entering text into a webbrowser field.
I'm actually trying to make a form that has many different text boxes.
It signs you up for a game so you can make multiple accounts quickly.
the link is
Code:
http://passport.nexon.net/Registration/Signup.aspx?nexonTheme=Maplestory
and this is what my form looks like:

I remember making something similar to this before and it had to do with the element name of the text box I wanted to enter something in.
For example, the first textbox on that site for Account ID is "txtAccountId"
EDIT2: And if possible after I get my application working, I would like to add to check if the name is available like it does on the website.
I also don't want it to just show the website in a web browser because it is cleaner this way and there would be no point in even making the program in the first place.
EDIT3: Also I am going to make it show the captcha image in that space with the gray lines. The captcha image id is "captchaFS_Image"
Last edited by WookieVagina; Mar 26th, 2010 at 07:52 PM.
-
Mar 26th, 2010, 08:17 PM
#4
Re: Entering text into a webbrowser field.
try this:
vb Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://passport.nexon.net/Registration/Signup.aspx?nexonTheme=Maplestory")
Do While WebBrowser1.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
Loop
Dim el As String = ""
For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("input")
el &= element.Name & Environment.NewLine
Next
MsgBox(el)
WebBrowser1.Document.All("txtAccountId").InnerText = "AccountId"
WebBrowser1.Document.All("txtPassword").InnerText = "Password"
WebBrowser1.Document.All("txtPasswordConfirmation").InnerText = "PasswordConfirmation"
WebBrowser1.Document.All("txtEmail").InnerText = "Email"
WebBrowser1.Document.All("txtEmailConfirmation").InnerText = "EmailConfirmation"
WebBrowser1.Document.All("txtFirstName").InnerText = "FirstName"
WebBrowser1.Document.All("txtLastName").InnerText = "LastName"
For Each element As HtmlElement In Me.WebBrowser1.Document.All("ddlBirthMonth").GetElementsByTagName("option")
If element.GetAttribute("text") = "January" Then
element.SetAttribute("selected", "True")
Exit For
End If
Next
For Each element As HtmlElement In Me.WebBrowser1.Document.All("ddlBirthDay").GetElementsByTagName("option")
If element.GetAttribute("text") = "1" Then
element.SetAttribute("selected", "True")
Exit For
End If
Next
For Each element As HtmlElement In Me.WebBrowser1.Document.All("ddlBirthYear").GetElementsByTagName("option")
If element.GetAttribute("text") = "2001" Then
element.SetAttribute("selected", "True")
Exit For
End If
Next
WebBrowser1.Document.GetElementById("rbGenderMale").SetAttribute("checked", "true")
WebBrowser1.Document.GetElementById("rbGenderFemale").SetAttribute("checked", "")
WebBrowser1.Document.All("txtCaptcha").InnerText = "Captcha"
WebBrowser1.Document.All("chkNewsletter").SetAttribute("checked", "true")
WebBrowser1.Document.All("chkTermofuse").SetAttribute("checked", "true")
WebBrowser1.Document.All("btnSubmit").InvokeMember("click")
End Sub
End Class
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 26th, 2010, 08:35 PM
#5
Re: Entering text into a webbrowser field.
EDIT2/ pass
EDIT3/ pass
that leaves you with something to research + find the answers to. if you search this forum i'm sure there is something about webbrowser images
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 26th, 2010, 08:44 PM
#6
Thread Starter
Lively Member
Re: Entering text into a webbrowser field.
WOW! Thanks so much.
Okay this is what I have so far.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Document.All("txtAccountId").InnerText = TextBox1.Text
WebBrowser1.Document.All("txtPassword").InnerText = MaskedTextBox1.Text
WebBrowser1.Document.All("txtPasswordConfirmation").InnerText = MaskedTextBox1.Text
WebBrowser1.Document.All("txtEmail").InnerText = TextBox2.Text
WebBrowser1.Document.All("txtEmailConfirmation").InnerText = TextBox2.Text
WebBrowser1.Document.All("txtFirstName").InnerText = TextBox6.Text
WebBrowser1.Document.All("txtLastName").InnerText = TextBox7.Text
If RadioButton1.Checked = True Then
WebBrowser1.Document.GetElementById("rbGenderMale").SetAttribute("checked", "true")
Else
WebBrowser1.Document.GetElementById("rbGenderFemale").SetAttribute("checked", "true")
End If
WebBrowser1.Document.All("txtCaptcha").InnerText = TextBox3.Text
WebBrowser1.Document.All("chkNewsletter").SetAttribute("checked", "false")
WebBrowser1.Document.All("chkTermofuse").SetAttribute("checked", "true")
WebBrowser1.Document.All("btnSubmit").InvokeMember("click")
End Sub
But I'm not sure how to set the birth date.
The Month drop down list is:
Code:
January
February
March
April
May
June
July
August
September
October
November
December
The day is:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
The years are:
Code:
1997
1996
1995
1994
1993
1992
1990
1989
1988
1987
1986
1985
1984
1983
1982
1981
1980
I'm just not sure how to make it select the same birthday that is chosen in the program.
Also, I'm not sure how to make the captcha show in the program where that gray box is.
EDIT: Also, the years on my program selection aren't the same as the websites ones, mine has much less.
-
Mar 26th, 2010, 08:49 PM
#7
Re: Entering text into a webbrowser field.
i told you how in post #4
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 26th, 2010, 09:08 PM
#8
Thread Starter
Lively Member
Re: Entering text into a webbrowser field.
I'm still having trouble with it.
when i do:
Code:
For Each element As HtmlElement In Me.WebBrowser1.Document.All("ddlBirthDay").GetElementsByTagName("option")
If element.GetAttribute("text") = "1" Then
element.SetAttribute("selected", "True")
Exit For
End If
Next
It sets the day to 1.
I am trying to make it so you can choose the day using my ComboBox2 which has all numbers 1 through 31 in it.
I really don't know how. =/
-
Mar 26th, 2010, 09:10 PM
#9
Re: Entering text into a webbrowser field.
If element.GetAttribute("text") = "1" Then
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 26th, 2010, 09:12 PM
#10
Thread Starter
Lively Member
Re: Entering text into a webbrowser field.
 Originally Posted by .paul.
If element.GetAttribute("text") = "1" Then
yeah I tried adding more of those, but it still sets it as 1 no matter what i choose in my combobox. I just don't know how to associate the browsers box with the forms combobox.
-
Mar 26th, 2010, 09:15 PM
#11
Re: Entering text into a webbrowser field.
vb Code:
If element.GetAttribute("text") = ComboBox2.selecteditem.tostring Then
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 26th, 2010, 09:17 PM
#12
Thread Starter
Lively Member
Re: Entering text into a webbrowser field.
wow.. i feel so stupid LOL
Thanks so much for that I got the days working
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|