Webbrowser Object

W

Webnewsreader

Hi,I have a webbrowser object with two frames with similar source
code<frameset cols="230,*">
<frame name="frame1" target="frm1" src="teste1.php?var=123">
<frame name="frame2" target="_blank" src="teste2.php?var=456">
</frameset>now the problem.At frame "frame1" there are several links that I
want to "click" or open in "frame2" using some coding"frame1" source
sample:<a href='pagina1.php?sessao=123' target='frame2'>Pagina1</a><a
href='pagina2.php?sessao=123' target='frame2'>Pagina2</a>
<a href='pagina3.php?sessao=123' target='frame2'>Pagina3</a>... I tried
almost everythingAny help would be preciated
 
C

Cor Ligthert [MVP]

Hi,

The webbrowser hosts a webdocument, what you shows us is in my opinion a
webdocument, that cannot direct be processed by the webbrowswer. Although
you can use MSHTML to process the content of that browswer.

Cor
 
B

billsahiker

use an htmldocument and navigate through the html elements. when you
get to the href you want, set an htmlanchorelement to it and then use
the naviate method and pass it that element. In the following code I
look for a submit button and click it. You can do similar with an
anchor element, i.e., a hyperlink. web refers to the webbrowser
control. Note that documentcomplete does not work as documented. It
will fire for each frame if the webpage uses frames. I used a timer
event and counted the frames until last one was loaded before calling
my getmail routine. The htmldocument will not load until all frames
have been parsed by the browser.

BTW, I saw an old post of yours where you had trouble capturing a video
frame to a picturebox using captureactivewindow. If you found a
solution I could sure use it.
Option Explicit
Dim iDoc As HTMLDocument
Dim InputEls As IHTMLElementCollection
Dim AnchorEl As HTMLAnchorElement
Dim InputSubmitElement As Object\

Private Sub GetMail()

web.navigate "http://www.hotmail.com"
While web.readyState <> READYSTATE_COMPLETE
x = DoEvents()
Wend
Set iDoc = web.document
Set InputSubmitElement = Nothing
' get a collection of all input tags
Set InputEls = iDoc.getElementsByTagName("INPUT")
For Each InputEl In InputEls
If UCase(InputEl.Type) = "PASSWORD" Then
InputEl.Value = "mypassword"
End If
Next
'now look for the submitt button to clik
For Each InputEl In InputEls
If UCase(InputEl.Type) = "SUBMIT" Then
Set InputSubmitElement = InputEl
'click button to navigate to the page
Dummy = InputSubmitElement.Click
End If
Next

End Sub

--Bill
 
W

Webnewsreader

Thanks you for your help
I will check it out


use an htmldocument and navigate through the html elements. when you
get to the href you want, set an htmlanchorelement to it and then use
the naviate method and pass it that element. In the following code I
look for a submit button and click it. You can do similar with an
anchor element, i.e., a hyperlink. web refers to the webbrowser
control. Note that documentcomplete does not work as documented. It
will fire for each frame if the webpage uses frames. I used a timer
event and counted the frames until last one was loaded before calling
my getmail routine. The htmldocument will not load until all frames
have been parsed by the browser.

BTW, I saw an old post of yours where you had trouble capturing a video
frame to a picturebox using captureactivewindow. If you found a
solution I could sure use it.
Option Explicit
Dim iDoc As HTMLDocument
Dim InputEls As IHTMLElementCollection
Dim AnchorEl As HTMLAnchorElement
Dim InputSubmitElement As Object\

Private Sub GetMail()

web.navigate "http://www.hotmail.com"
While web.readyState <> READYSTATE_COMPLETE
x = DoEvents()
Wend
Set iDoc = web.document
Set InputSubmitElement = Nothing
' get a collection of all input tags
Set InputEls = iDoc.getElementsByTagName("INPUT")
For Each InputEl In InputEls
If UCase(InputEl.Type) = "PASSWORD" Then
InputEl.Value = "mypassword"
End If
Next
'now look for the submitt button to clik
For Each InputEl In InputEls
If UCase(InputEl.Type) = "SUBMIT" Then
Set InputSubmitElement = InputEl
'click button to navigate to the page
Dummy = InputSubmitElement.Click
End If
Next

End Sub

--Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top