|
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.
|
|
|
|
|
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
|
|
|
|