Click here to Skip to main content
       

Visual Basic

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questionvb.net Web Browser Control! how to automate when web page is using frames.memberKieran Sloan7 Nov '12 - 4:27 
A web page I'm trying to automate has come to my attention that it using frames. the source is and link to page is below:
 
url: http://www.konaeuropeadmin.com/[^]
 
My code so far...
 
Dim theElementCollection As HtmlElementCollection = KonaBrwsr.Document.GetElementsByTagName("input")
 
        For Each curElement As HtmlElement In theElementCollection
 
            Dim controlName As String = curElement.GetAttribute("name")
 
            If controlName = "loginname" Then
                curElement.SetAttribute("Value", "username")
            End If
 
            If controlName = "loginpassword" Then
                curElement.SetAttribute("Value", "password")
            End If
 
            If controlName = "savepassword" Then
                curElement.SetAttribute("Value", "True")
            End If
 
        Next
 
        Dim theElementCollection2 As HtmlElementCollection = KonaBrwsr.Document.GetElementsByTagName("input")
 
        For Each curElement2 As HtmlElement In theElementCollection2
 
            Dim controlName2 As String = curElement2.GetAttribute("name").ToString
 
            If controlName2 = "login" Then
                curElement2.InvokeMember("Click")
            End If
 
        Next
 

I know this works as I've used the same procedure for all the webpages I'm trying to automate... 15 in total; downloading files automatically.
 
The problem with this site is that it uses frames, and although I know my code work for a simple HTML form, I have no idea how to repeat this procedure for a framed website.
 
Someone please help, I've been on this for a while now and simply not working for me.
 
Thank you all in advance.
AnswerRe: vb.net Web Browser Control! how to automate when web page is using frames. PinmemberZaf Khan26 Nov '12 - 2:13 
Inside the page (in your link) you will find the following code.......
 
<html>
<head>
<title>Kona Europe</title>
<frameset rows="92,*">
    <frame name="enterpart" scrolling="no" noresize>
    <frameset cols="310,*">
        <frame name="treeframe" src="http://www.konaeuropeadmin.com/getcountry.htm">
        <frame name="basefrm" src="http://www.konaeuropeadmin.com/website/rightframe.htm">
    </frameset>
    <noframes>
        <body>
        <p>This page uses frames, but your browser doesn't support them.</p>
        </body>
    </noframes>
</frameset>
</html>
 

in THAT page (the page in your link - or even ANY other page you wish)
 

first assess if the FRAME or IFRAME tag is present and if it is then load the SRC file that the individual FRAME SRC points to and then run your code for EACH frame and treat each frame as a separate html document.
 
If the fields your looking for are there then your code will do what its supposed to and if not then your code shouldnt do anything and you simply continue to the next frame.
 
If theres NO frames then your code will operate as normal....
 
See the pseudo code below
 
'1   Get the ORIGINAL document
'2     look for the FRAME tag (if no frame tags jump to step 10)
'3       in the frame tag look for the SRC attribute/element
'4         load the document using the SRC as the file to load pointer
'5           == YOUR CODE HERE ==
'6         we are done with this document 
'7       we are done with this frame
'8     move to the next frame (and repeat till no more frames)
'9   All done - jump to step 12
'10  == YOUR CODE HERE ==
'11  All done  - jump to step 12
'12  Finished

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 20 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid