Website Typer

Posts 1–11 of 11 · Page 1 of 1
Website Typer
Hello,

Something i don't know at VB.

I added a webbrowser to my program and opened a website,
That website has a console and i know the ID of the command box via Page Source.

What i have:
-Button
-Textbox
-WebBrowser

I want to know how when i click on the button the text in the Textbox transfers to the Console's Command box in the Webbrowser (NOT EXTERNAL WB)


--------------------
This is the code if i want to press a button

Code:
WebBrowser.Document.GetElementById("ButtonID").InvokeMember("click")
Thank you.

Sorry if you didn't understand.
WebBrowser.Document.GetElementById("commandBoxID") .InnerText = myTextBox1.Text

I think?

HtmlElement Class (System.Windows.Forms)

Code:
WebBrowser.Document.GetElementById("BoxID").InnerText = myTextBox1.Text ''set text box
WebBrowser.Document.GetElementById("ButtonID").InvokeMember("click")       ''click submit button
Quote Originally Posted by abuckau907 View Post
WebBrowser.Document.GetElementById("commandBoxID") .InnerText = myTextBox1.Text

I think?

HtmlElement Class (System.Windows.Forms)

Code:
WebBrowser.Document.GetElementById("BoxID").InnerText = myTextBox1.Text ''set text box
WebBrowser.Document.GetElementById("ButtonID").InvokeMember("click")       ''click submit button
Yea that's what i want thank you bro
But if you can tell me Enter code to let the console read the command?
i tried SendKeys.Key({Enter}) but it doesn't work, i need to click on the CommandBox, i want it automatic if you can =)
Quote Originally Posted by Mayion View Post

...
But if you can tell me Enter code to let the console read the command?
...
Sorry, not sure what you mean. ?

edit:

... i need to click on the CommandBox ...
You mean focus it? Make it the active control? Idk off the top of my head, but I bet it's in the msdn link I posted. Will check after I save post.

edit2: Yes, it has a "Focus()" method, if that's what you mean?

WebBrowser.Document.GetElementById("BoxID").Focus()
edit3: (server went down) I'm not sure what you're trying to do.

1. Load the page '' works
2. Set the textbox (you call commandbox)'s .text ''works
3. Click the submit button ''works

What else are you trying to do?
Quote Originally Posted by Mayion View Post

Really thank you for helping, but my English was bad a bit.
But after you told me InnerText the text in the Textbox goes to CommandBox.
Now i want after that, it automatic clicks Enter so the CommandBox reads the text i wrote.
Did you understand what i mean now?
also sorry i said it wrong at the thread
after you call .GetElementByID("BoxID").InnerText = "****"

is the GUI not updating/displaying the text as it should be?

I just tested it a minute ago: The webbrowser control does have an "Update()" method to "Redraw ...[the page]", but I didn't need it.



I'm not sure what you mean by "reading" it. Does the gui not update?

-------------
Are you sure the webpage has finished loading before you try to modify the text box?
Post code. And screenshots..

edit: You literally just want to press the {enter} key --> so the browser will send the text to the server.. ?

try keybd_event() , I think it will work to press any key : )
...I'm not sure the proper way to do it. Might google it for you later...
Quote Originally Posted by abuckau907 View Post
after you call .GetElementByID("BoxID").InnerText = "****"

is the GUI not updating/displaying the text as it should be?

I just tested it a minute ago: The webbrowser control does have an "Update()" method to "Redraw ...[the page]", but I didn't need it.



I'm not sure what you mean by "reading" it. Does the gui not update?

-------------
Are you sure the webpage has finished loading before you try to modify the text box?
Post code. And screenshots..
My English was bad while I'm writing my last replay but here you go

after you told me InnerText code, the text in the Textbox goes to CommandBox.
Now i want after that, it automatic clicks Enter so the Console reads the text i wrote at CommandBox
Did you understand what i mean now?


Steps:
-I Click on the button
-The text in the Textbox goes to the CommandBox
-When the text goes to the CommandBox, It automatic clicks Enter to let the Console Read the Command/Test


I Hope you understood now, and sorry
Quote Originally Posted by Mayion View Post

Steps:
-I Click on the button
-The text in the Textbox goes to the CommandBox
-When the text goes to the CommandBox, It automatic clicks Enter to let the Console Read the Command/Test

I Hope you understood now, and sorry
yep, no worries : )

anyway, you said you tried SendKeys.Send() ....did you focus the commandbox first ??

Code:
WebBrowser.Document.GetElementById("BoxID").InnerText = myTextBox1.Text ''set text box
WebBrowser.Document.GetElementById("BoxID").Focus()
SendKeys.Send("{ENTER}")
Quote Originally Posted by abuckau907 View Post
yep, no worries : )

anyway, you said you tried SendKeys.Send() ....did you focus the commandbox first ??

Code:
WebBrowser.Document.GetElementById("BoxID").InnerText = myTextBox1.Text ''set text box
WebBrowser.Document.GetElementById("BoxID").Focus()
SendKeys.Send("{ENTER}")
Working Now, Thank you for helping me =)
Mayion, are you really coding a bot ?
Quote Originally Posted by Lovroman View Post
Mayion, are you really coding a bot ?
Bot?
I'm coding Control Panel, so i need to connect with the website. xD
Quote Originally Posted by Mayion View Post


Bot?
I'm coding Control Panel, so i need to connect with the website. xD
When I saw:
Code:
WebBrowser.Document.GetElementById("BoxID").InnerText = myTextBox1.Text 
+
WebBrowser.Document.GetElementById("ButtonID").InvokeMember("click")
I tought you're coding bot.
Posts 1–11 of 11 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us