Board index » Visual Studio » HTML "submit" without Browser

HTML "submit" without Browser

Visual Studio304
Hi!

I need to submit an HTML form programmatically but I don't

want to use an HTTP POST. Instead I would like to simulate

a "hidden" button click on "submit" ("click" without using

a browser window).

Here is what I want in pseudo-code:



HTMLDocument doc

doc.LoadURL(url)



HTMLInputElement login = doc.GetInputItem("username")

login.value = "loginname"



HTMLInputElement passwd = doc.GetInputItem("password")

passwd.value = "password"



HTMLInputElement submit = doc.GetInputItem("submit")

submit.click()



Can anyone provide me some easy-to-understand code

snipplet? I checked several examples like the MSDN

WalkAll, but I didn't understand it =>too complicated for

me :-(.


-
 

Re:HTML "submit" without Browser

I have done this successfully using IWebBrowser2's object model. I found the

book by Scott Roberts(for IE5) to be very helpful. Its been a while since I

did this but you have the right idea. You need to do this when the document

is completely loaded. Search Codeguru for samples as well or if you can get

hold of the Scott's book's samples, that will be helpful.



--

Ajay Kalra [MVP - VC++]

ajaykalra@yahoo.com





"Julia Weber" <anonymous@discussions.microsoft.com>wrote in message

Quote
Hi!

I need to submit an HTML form programmatically but I don't

want to use an HTTP POST. Instead I would like to simulate

a "hidden" button click on "submit" ("click" without using

a browser window).

Here is what I want in pseudo-code:



HTMLDocument doc

doc.LoadURL(url)



HTMLInputElement login = doc.GetInputItem("username")

login.value = "loginname"



HTMLInputElement passwd = doc.GetInputItem("password")

passwd.value = "password"



HTMLInputElement submit = doc.GetInputItem("submit")

submit.click()



Can anyone provide me some easy-to-understand code

snipplet? I checked several examples like the MSDN

WalkAll, but I didn't understand it =>too complicated for

me :-(.





-

Re:HTML "submit" without Browser

Thanks Ajay! I found a code example in Codeguru, which was

very helpful and also understandable!

For everybody who have the same problem, take a look at

the "Creating an Internet Explorer Helper Class" article:



www.codeguru.com/Cpp/I-">www.codeguru.com/Cpp/I-

N/internet/browsercontrol/article.php/c6175/





Quote
-----Originalnachricht-----

I have done this successfully using IWebBrowser2's object

model. I found the

book by Scott Roberts(for IE5) to be very helpful. Its

been a while since I

did this but you have the right idea. You need to do this

when the document

is completely loaded. Search Codeguru for samples as well

or if you can get

hold of the Scott's book's samples, that will be helpful.



--

Ajay Kalra [MVP - VC++]

ajaykalra@yahoo.com





"Julia Weber" <anonymous@discussions.microsoft.com>wrote

in message

news:335b01c42927$f28607f0$a401280a@phx.gbl...

>Hi!

>I need to submit an HTML form programmatically but I

don't

>want to use an HTTP POST. Instead I would like to

simulate

>a "hidden" button click on "submit" ("click" without

using

>a browser window).

>Here is what I want in pseudo-code:

>

>HTMLDocument doc

>doc.LoadURL(url)

>

>HTMLInputElement login = doc.GetInputItem("username")

>login.value = "loginname"

>

>HTMLInputElement passwd = doc.GetInputItem("password")

>passwd.value = "password"

>

>HTMLInputElement submit = doc.GetInputItem("submit")

>submit.click()

>

>Can anyone provide me some easy-to-understand code

>snipplet? I checked several examples like the MSDN

>WalkAll, but I didn't understand it =>too complicated

for

>me :-(.





.



-