469,621 Members | 1,685 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

Read page info from WebBrowser control?

I am able to place values on forms that load into my webbrowser control, but
I'd like to be able to scan the page for data. I know to use the
HTMLDocument object.

Basically I'm hoping to find an example of a DocumentComplete routine that
will:

- display a list of all elements (tags?) on the page
- number of forms on the page
- ID, name, type and value for each field on the form
- and how I should handle a page with multiple frames.

I've found numerous examples through Google, but they are all VERY simple as
they assume you know what form index and element names are on the page
already. I can't find any samples that can scan a random page and produce
some output.

Thanks!
Jul 17 '05 #1
7 7820
You need to research the IE DOM. It's all there.
The "all" collection gives you all tags in the page.
Each item in the "all" collection is an IHTMLElement
object. An IHTMLElement may also have children
IHTMLElements. Each has a Tagname property,
access to get and put attributes, catch events, etc.
You can do just about anything to the page that you
want to.

--
--
Noozer <do*******@me.here> wrote in message
news:mv_oc.475330$Ig.437986@pd7tw2no...
I am able to place values on forms that load into my webbrowser control, but I'd like to be able to scan the page for data. I know to use the
HTMLDocument object.

Basically I'm hoping to find an example of a DocumentComplete routine that
will:

- display a list of all elements (tags?) on the page
- number of forms on the page
- ID, name, type and value for each field on the form
- and how I should handle a page with multiple frames.

I've found numerous examples through Google, but they are all VERY simple as they assume you know what form index and element names are on the page
already. I can't find any samples that can scan a random page and produce
some output.

Thanks!

Jul 17 '05 #2
Can you send an enter key press?

"mayayana" <ma************@mindZZspring.com> wrote in message
news:At*****************@newsread3.news.atl.earthl ink.net...
You need to research the IE DOM. It's all there.
The "all" collection gives you all tags in the page.
Each item in the "all" collection is an IHTMLElement
object. An IHTMLElement may also have children
IHTMLElements. Each has a Tagname property,
access to get and put attributes, catch events, etc.
You can do just about anything to the page that you
want to.

--
--
Noozer <do*******@me.here> wrote in message
news:mv_oc.475330$Ig.437986@pd7tw2no...
I am able to place values on forms that load into my webbrowser control, but
I'd like to be able to scan the page for data. I know to use the
HTMLDocument object.

Basically I'm hoping to find an example of a DocumentComplete routine that will:

- display a list of all elements (tags?) on the page
- number of forms on the page
- ID, name, type and value for each field on the form
- and how I should handle a page with multiple frames.

I've found numerous examples through Google, but they are all VERY simple as
they assume you know what form index and element names are on the page
already. I can't find any samples that can scan a random page and

produce some output.

Thanks!


Jul 17 '05 #3
You mean send it to the page?

'-- assuming you've got the document object as Doc:

Dim TR As IHTMLTxtRange
Set TR = Doc.Body.CreateTextRange
TR.pasteHtml "<BR>"
(You may need to also paste a "#nbsp;" to actually
show the return in the page. And you can use the Move,
MoveToPoint, etc. methods to position where the return
happens.)

If you mean a SendKeys to the WB window, in order
to "click" something, I don't know the best way to do that.
Can you send an enter key press?

You need to research the IE DOM. It's all there.
The "all" collection gives you all tags in the page.
Each item in the "all" collection is an IHTMLElement
object. An IHTMLElement may also have children
IHTMLElements. Each has a Tagname property,
access to get and put attributes, catch events, etc.
You can do just about anything to the page that you
want to.

--
--
Noozer <do*******@me.here> wrote in message
news:mv_oc.475330$Ig.437986@pd7tw2no...
I am able to place values on forms that load into my webbrowser
control,
but
I'd like to be able to scan the page for data. I know to use the
HTMLDocument object.

Basically I'm hoping to find an example of a DocumentComplete routine

that will:

- display a list of all elements (tags?) on the page
- number of forms on the page
- ID, name, type and value for each field on the form
- and how I should handle a page with multiple frames.

I've found numerous examples through Google, but they are all VERY simple
as
they assume you know what form index and element names are on the page
already. I can't find any samples that can scan a random page and

produce some output.

Thanks!



Jul 17 '05 #4
Hi mayayana,

How could you move a vertical scroll bar down to the bottom?

My problem is that when I insert a line of text into an Internet
Explorer_Server window, the document fails to scroll up, and so the new line
of text is not visible (unless I manually scroll up by clicking the bottom
of the scroll bar).
PS. Could someone please repost this message to the original list of
newsgroups
(comp.lang.basic.visual,comp.lang.visual.basic,mic rosoft.public.vb.controls.
internet) as I only have access to the MS news server, and I don't think
mayayana is subscribed here. Thanks.

"mayayana" <ma************@mindZZspring.com> wrote in message
news:At*****************@newsread3.news.atl.earthl ink.net...
You need to research the IE DOM. It's all there.
The "all" collection gives you all tags in the page.
Each item in the "all" collection is an IHTMLElement
object. An IHTMLElement may also have children
IHTMLElements. Each has a Tagname property,
access to get and put attributes, catch events, etc.
You can do just about anything to the page that you
want to.

--
--
Noozer <do*******@me.here> wrote in message
news:mv_oc.475330$Ig.437986@pd7tw2no...
I am able to place values on forms that load into my webbrowser control, but
I'd like to be able to scan the page for data. I know to use the
HTMLDocument object.

Basically I'm hoping to find an example of a DocumentComplete routine that will:

- display a list of all elements (tags?) on the page
- number of forms on the page
- ID, name, type and value for each field on the form
- and how I should handle a page with multiple frames.

I've found numerous examples through Google, but they are all VERY simple as
they assume you know what form index and element names are on the page
already. I can't find any samples that can scan a random page and

produce some output.

Thanks!


Jul 17 '05 #5
I'm not sure about that. You can scroll the page with this:
WB.Document.body.scrolltop

It's a Read/Write Long value in pixels that can return or set
the pixel point showing at the top of the browser window.
To scroll to the bottom I guess you'd need to get the page height
and window height to figure it out. Or maybe you could just
set scrolltop to something very large. In other words, if the
page is 800 pixels high and the window is 700 pixels high
then setting scrolltop to 100 would scroll to the bottom. I'm
guessing that setting scrolltop to, say, 2000 might also work.
How could you move a vertical scroll bar down to the bottom?

My problem is that when I insert a line of text into an Internet
Explorer_Server window, the document fails to scroll up, and so the new line of text is not visible (unless I manually scroll up by clicking the bottom
of the scroll bar).
PS. Could someone please repost this message to the original list of
newsgroups
(comp.lang.basic.visual,comp.lang.visual.basic,mic rosoft.public.vb.controls. internet) as I only have access to the MS news server, and I don't think
mayayana is subscribed here. Thanks.

"mayayana" <ma************@mindZZspring.com> wrote in message
news:At*****************@newsread3.news.atl.earthl ink.net...
You need to research the IE DOM. It's all there.
The "all" collection gives you all tags in the page.
Each item in the "all" collection is an IHTMLElement
object. An IHTMLElement may also have children
IHTMLElements. Each has a Tagname property,
access to get and put attributes, catch events, etc.
You can do just about anything to the page that you
want to.

--
--
Noozer <do*******@me.here> wrote in message
news:mv_oc.475330$Ig.437986@pd7tw2no...
I am able to place values on forms that load into my webbrowser
control,
but
I'd like to be able to scan the page for data. I know to use the
HTMLDocument object.

Basically I'm hoping to find an example of a DocumentComplete routine

that will:

- display a list of all elements (tags?) on the page
- number of forms on the page
- ID, name, type and value for each field on the form
- and how I should handle a page with multiple frames.

I've found numerous examples through Google, but they are all VERY simple
as
they assume you know what form index and element names are on the page
already. I can't find any samples that can scan a random page and

produce some output.

Thanks!



Jul 17 '05 #6
Hi mayayana,

My object doesn't seem to have that property. I've tried several other
suggestions seen on Web sites too, but none of them seem to work with this
object.

I'm using this code
http://www.planet-source-code.com/vb...50433&lngWId=1
to attach onto the new Yahoo! Messenger 6 BETA's
http://messenger.yahoo.com/beta/winbeta.php IM windows (Yahoo! uses the
Internet Explorer_Server). The code works very well.

My program inserts a status message into my IM window. If Messenger already
had a status message showing in the window, then my program deletes the
status HTML code and inserts my own to show the new status message. This
works seemlessly.

The problem only arrises when there wasn't already a status there. If I just
insert my own status, the IM window doesn't scroll up as it normally does.
The user is left to scroll up manually, although from then on the window
scrolls automatically as normal.

I've compared all the innerHTML and outerHTML code of when Messenger inserts
it's status with when my program inserts a status, and they are identicle.

So the question is, when Messenger inserts a status for the first time, what
else does it do to ensure the window scrolls? I've seen a .autoscroll
method, but it had no effect either.

Any ideas? I suppose I would be too lucky if you're a Yahoo! Messenger user
:)

"mayayana" <ma************@mindZZspring.com> wrote in message
news:yr*******************@newsread3.news.atl.eart hlink.net...
I'm not sure about that. You can scroll the page with this:
WB.Document.body.scrolltop

It's a Read/Write Long value in pixels that can return or set
the pixel point showing at the top of the browser window.
To scroll to the bottom I guess you'd need to get the page height
and window height to figure it out. Or maybe you could just
set scrolltop to something very large. In other words, if the
page is 800 pixels high and the window is 700 pixels high
then setting scrolltop to 100 would scroll to the bottom. I'm
guessing that setting scrolltop to, say, 2000 might also work.
How could you move a vertical scroll bar down to the bottom?

My problem is that when I insert a line of text into an Internet
Explorer_Server window, the document fails to scroll up, and so the new

line
of text is not visible (unless I manually scroll up by clicking the bottom
of the scroll bar).
PS. Could someone please repost this message to the original list of
newsgroups

(comp.lang.basic.visual,comp.lang.visual.basic,mic rosoft.public.vb.controls.
internet) as I only have access to the MS news server, and I don't think
mayayana is subscribed here. Thanks.

"mayayana" <ma************@mindZZspring.com> wrote in message
news:At*****************@newsread3.news.atl.earthl ink.net...
You need to research the IE DOM. It's all there.
The "all" collection gives you all tags in the page.
Each item in the "all" collection is an IHTMLElement
object. An IHTMLElement may also have children
IHTMLElements. Each has a Tagname property,
access to get and put attributes, catch events, etc.
You can do just about anything to the page that you
want to.

--
--
Noozer <do*******@me.here> wrote in message
news:mv_oc.475330$Ig.437986@pd7tw2no...
> I am able to place values on forms that load into my webbrowser control, but
> I'd like to be able to scan the page for data. I know to use the
> HTMLDocument object.
>
> Basically I'm hoping to find an example of a DocumentComplete routine that
> will:
>
> - display a list of all elements (tags?) on the page
> - number of forms on the page
> - ID, name, type and value for each field on the form
> - and how I should handle a page with multiple frames.
>
> I've found numerous examples through Google, but they are all VERY

simple
as
> they assume you know what form index and element names are on the

page > already. I can't find any samples that can scan a random page and

produce
> some output.
>
> Thanks!
>
>



Jul 17 '05 #7
Sorry. I've never used IM, so I only have a vague
idea of what you're talking about.

--

My object doesn't seem to have that property. I've tried several other
suggestions seen on Web sites too, but none of them seem to work with this
object.

I'm using this code
http://www.planet-source-code.com/vb...odeId=50433&ln
gWId=1 to attach onto the new Yahoo! Messenger 6 BETA's
http://messenger.yahoo.com/beta/winbeta.php IM windows (Yahoo! uses the
Internet Explorer_Server). The code works very well.

My program inserts a status message into my IM window. If Messenger already had a status message showing in the window, then my program deletes the
status HTML code and inserts my own to show the new status message. This
works seemlessly.

The problem only arrises when there wasn't already a status there. If I just insert my own status, the IM window doesn't scroll up as it normally does.
The user is left to scroll up manually, although from then on the window
scrolls automatically as normal.

I've compared all the innerHTML and outerHTML code of when Messenger inserts it's status with when my program inserts a status, and they are identicle.

So the question is, when Messenger inserts a status for the first time, what else does it do to ensure the window scrolls? I've seen a .autoscroll
method, but it had no effect either.

Any ideas? I suppose I would be too lucky if you're a Yahoo! Messenger user :)

"mayayana" <ma************@mindZZspring.com> wrote in message
news:yr*******************@newsread3.news.atl.eart hlink.net...
I'm not sure about that. You can scroll the page with this:
WB.Document.body.scrolltop

It's a Read/Write Long value in pixels that can return or set
the pixel point showing at the top of the browser window.
To scroll to the bottom I guess you'd need to get the page height
and window height to figure it out. Or maybe you could just
set scrolltop to something very large. In other words, if the
page is 800 pixels high and the window is 700 pixels high
then setting scrolltop to 100 would scroll to the bottom. I'm
guessing that setting scrolltop to, say, 2000 might also work.
How could you move a vertical scroll bar down to the bottom?

My problem is that when I insert a line of text into an Internet
Explorer_Server window, the document fails to scroll up, and so the new
line
of text is not visible (unless I manually scroll up by clicking the bottom of the scroll bar).
PS. Could someone please repost this message to the original list of
newsgroups

(comp.lang.basic.visual,comp.lang.visual.basic,mic rosoft.public.vb.controls. internet) as I only have access to the MS news server, and I don't think mayayana is subscribed here. Thanks.

"mayayana" <ma************@mindZZspring.com> wrote in message
news:At*****************@newsread3.news.atl.earthl ink.net...
> You need to research the IE DOM. It's all there.
> The "all" collection gives you all tags in the page.
> Each item in the "all" collection is an IHTMLElement
> object. An IHTMLElement may also have children
> IHTMLElements. Each has a Tagname property,
> access to get and put attributes, catch events, etc.
> You can do just about anything to the page that you
> want to.
>
> --
> --
> Noozer <do*******@me.here> wrote in message
> news:mv_oc.475330$Ig.437986@pd7tw2no...
> > I am able to place values on forms that load into my webbrowser

control,
> but
> > I'd like to be able to scan the page for data. I know to use the
> > HTMLDocument object.
> >
> > Basically I'm hoping to find an example of a DocumentComplete routine that
> > will:
> >
> > - display a list of all elements (tags?) on the page
> > - number of forms on the page
> > - ID, name, type and value for each field on the form
> > - and how I should handle a page with multiple frames.
> >
> > I've found numerous examples through Google, but they are all VERY
simple
> as
> > they assume you know what form index and element names are on the page > > already. I can't find any samples that can scan a random page and
produce
> > some output.
> >
> > Thanks!
> >
> >
>
>



Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Noah Coad [MVP .NET/C#] | last post: by
1 post views Thread by DEWright_CA | last post: by
1 post views Thread by Tim Sprout | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.