ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Writing values to Web Forms (https://www.excelbanter.com/excel-programming/278643-writing-values-web-forms.html)

Brian Lopez

Writing values to Web Forms
 
All:

Is it possible to write values, using VB, to a web form in
IE?

Thanks,
Brian A Lopez

Jake Marx[_3_]

Writing values to Web Forms
 
Hi Brian,

Yes, but it takes a bit of doing. Check out the following thread to get
some ideas. If you need more assistance, please post back with what URL
you're trying to post data to.

http://groups.google.com/groups?hl=e...%40tkmsftngp07

(watch for URL wrap)

--
Regards,

Jake Marx
www.longhead.com


Brian Lopez wrote:
All:

Is it possible to write values, using VB, to a web form in
IE?

Thanks,
Brian A Lopez



Brian A lopez

Writing values to Web Forms
 
I guess my attempt is extremely complicated.
In the login screen example, I would like to read the text
to the left of the combobox and the enter the appropriate
values before I would click on signon.

Is this even possible, does IE cooperate with VB?


-----Original Message-----
Hi Brian,

Yes, but it takes a bit of doing. Check out the

following thread to get
some ideas. If you need more assistance, please post

back with what URL
you're trying to post data to.

http://groups.google.com/groups?hl=e...=UTF-8&oe=UTF-

8&threadm=ePVhhRXlBHA.2180%40tkmsftngp07

(watch for URL wrap)

--
Regards,

Jake Marx
www.longhead.com


Brian Lopez wrote:
All:

Is it possible to write values, using VB, to a web form

in
IE?

Thanks,
Brian A Lopez


.


Jake Marx[_3_]

Writing values to Web Forms
 
Hi Brian,

Yes, you can do this. If the text is within a named HTML element (if the
element has id="foo" or name="foo" in the tag), it is easier to get via the
GetElementByID or GetElementByName, which are methods of the Document or
Body object, I think. If not, you'll have to search the whole body for it
using Document.Body.InnerText or InnerHTML to get the text or source of the
document body.

So the process would go: 1) navigate to the signon page, 2) read the value
you need using one of the methods above, 3) post the form data to the signon
processing page (the action attribute of the form element), then hopefully
you'll be logged in.

If you continue to have problems, please post the URL, and I'd be happy to
help you further.

--
Regards,

Jake Marx
www.longhead.com


Brian A lopez wrote:
I guess my attempt is extremely complicated.
In the login screen example, I would like to read the text
to the left of the combobox and the enter the appropriate
values before I would click on signon.

Is this even possible, does IE cooperate with VB?


-----Original Message-----
Hi Brian,

Yes, but it takes a bit of doing. Check out the following thread to
get some ideas. If you need more assistance, please post back with
what URL you're trying to post data to.

http://groups.google.com/groups?hl=e...=UTF-8&oe=UTF-

8&threadm=ePVhhRXlBHA.2180%40tkmsftngp07

(watch for URL wrap)

--
Regards,

Jake Marx
www.longhead.com


Brian Lopez wrote:
All:

Is it possible to write values, using VB, to a web form in
IE?

Thanks,
Brian A Lopez


.



RJB[_4_]

Writing values to Web Forms
 
"Jake Marx" wrote in message ...

I'm working on a similar problem and having some difficulty.
Two things:

First when I execute this line of code having previously created the
IE object and made it visible

oInt.Navigate sURL, 0, " self", bytePost, sHeader

I get a second IE window. I've played with " self" trying "_SELF",
"_self", etc. to no effect. What am I missing?

Second, the form looks like this:

<form name="content" method="post"
<input type="hidden" size="-1" name="form_validate" value="1"
<input type="hidden" size="-1" name="cid"
<input type="hidden" size="-1" name="cntid"
<input type="hidden" size="-1" name="attid"

I'm sending through a post of

form_validate=1&cid=4343&cntid=&attid=

that is converted by

bytePost = StrConv(bytePostData, vbFromUnicode)

and a header of

sHeader = "Content-Type: " & _
"application/x-www-form-urlencoded" & vbCrLf

Unfortunately, I do not get the expected page.

Any clues?

Thanks,
Richard





Hi Brian,

Yes, you can do this. If the text is within a named HTML element (if the
element has id="foo" or name="foo" in the tag), it is easier to get via the
GetElementByID or GetElementByName, which are methods of the Document or
Body object, I think. If not, you'll have to search the whole body for it
using Document.Body.InnerText or InnerHTML to get the text or source of the
document body.

So the process would go: 1) navigate to the signon page, 2) read the value
you need using one of the methods above, 3) post the form data to the signon
processing page (the action attribute of the form element), then hopefully
you'll be logged in.

If you continue to have problems, please post the URL, and I'd be happy to
help you further.

--
Regards,

Jake Marx
www.longhead.com


Brian A lopez wrote:
I guess my attempt is extremely complicated.
In the login screen example, I would like to read the text
to the left of the combobox and the enter the appropriate
values before I would click on signon.

Is this even possible, does IE cooperate with VB?


-----Original Message-----
Hi Brian,

Yes, but it takes a bit of doing. Check out the following thread to
get some ideas. If you need more assistance, please post back with
what URL you're trying to post data to.

http://groups.google.com/groups?hl=e...=UTF-8&oe=UTF-

8&threadm=ePVhhRXlBHA.2180%40tkmsftngp07

(watch for URL wrap)

--
Regards,

Jake Marx
www.longhead.com


Brian Lopez wrote:
All:

Is it possible to write values, using VB, to a web form in
IE?

Thanks,
Brian A Lopez

.


RJB[_4_]

Writing values to Web Forms
 
(RJB) wrote in message . com...

I was clearly having a case of the stupids this mourning.

I should have and am now coding
oInt.Navigate sURL, 0, "", bytePost, sHeader
and now the extra windows are gone. I should note that this problem
is only apparent if the windows are visible, but it's there either
way.

The solution to the second problem, not apparent from my original
post, is that I was (duh) sending through the wrong URL.

BTW, there is a useful knowledge base article HOWTO: Use the PostData
Parameter in WebBrowser Control that the group may want to be aware
of.

Also, there are issues in testing readystate complete when the page
referenced has frames (I'm still working that out, but readystate will
go to complete for each frame as near as I can tell). The example code
I've seen will ocassionally fail (it's also timing dependent). There
are also issues determining if the page actually downloaded (still
working that out as well).

Regards,
RJB


"Jake Marx" wrote in message ...

I'm working on a similar problem and having some difficulty.
Two things:

First when I execute this line of code having previously created the
IE object and made it visible

oInt.Navigate sURL, 0, " self", bytePost, sHeader

I get a second IE window. I've played with " self" trying "_SELF",
"_self", etc. to no effect. What am I missing?

Second, the form looks like this:

<form name="content" method="post"
<input type="hidden" size="-1" name="form_validate" value="1"
<input type="hidden" size="-1" name="cid"
<input type="hidden" size="-1" name="cntid"
<input type="hidden" size="-1" name="attid"

I'm sending through a post of

form_validate=1&cid=4343&cntid=&attid=

that is converted by

bytePost = StrConv(bytePostData, vbFromUnicode)

and a header of

sHeader = "Content-Type: " & _
"application/x-www-form-urlencoded" & vbCrLf

Unfortunately, I do not get the expected page.

Any clues?

Thanks,
Richard





Hi Brian,

Yes, you can do this. If the text is within a named HTML element (if the
element has id="foo" or name="foo" in the tag), it is easier to get via the
GetElementByID or GetElementByName, which are methods of the Document or
Body object, I think. If not, you'll have to search the whole body for it
using Document.Body.InnerText or InnerHTML to get the text or source of the
document body.

So the process would go: 1) navigate to the signon page, 2) read the value
you need using one of the methods above, 3) post the form data to the signon
processing page (the action attribute of the form element), then hopefully
you'll be logged in.

If you continue to have problems, please post the URL, and I'd be happy to
help you further.

--
Regards,

Jake Marx
www.longhead.com


Brian A lopez wrote:
I guess my attempt is extremely complicated.
In the login screen example, I would like to read the text
to the left of the combobox and the enter the appropriate
values before I would click on signon.

Is this even possible, does IE cooperate with VB?


-----Original Message-----
Hi Brian,

Yes, but it takes a bit of doing. Check out the following thread to
get some ideas. If you need more assistance, please post back with
what URL you're trying to post data to.

http://groups.google.com/groups?hl=e...=UTF-8&oe=UTF-

8&threadm=ePVhhRXlBHA.2180%40tkmsftngp07

(watch for URL wrap)

--
Regards,

Jake Marx
www.longhead.com


Brian Lopez wrote:
All:

Is it possible to write values, using VB, to a web form in
IE?

Thanks,
Brian A Lopez

.



All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com