I am attempting to automate a form on our business proprietary website - which has nested frames. There are a few select drop-down elements and a few text box elements on the frame. I have searched the internet and tried just about everything but keep failing to snag the sub frames needed to fill out the form. I'm hoping someone with experience can take a moment to direct me.
There is another non-secure website built on the exact same frameset as our proprietary page that I can direct you too. This is the info I can so far assess:
Site: http://webcache.gmc-uk.org/gmclrmp_enu/start.swe
(I found this while searching for excel help on the frame name "_sweclient")
(The designer must have used the same software to create this page that my outfit used.)
Frame Hierarchy: "_sweclient" --> wasn't able to get far enough to find any more sub frames - but it used to be "_sweview"
Text Box element Name = 's_3_1_6_0'
Text Box element ID = "surname"
Whenever I try to snag the frame document it returns the top document. I had a working version a couple of years ago but they have updated the site and now I am hitting a brick wall.
Below is my code thus far. (I need to connect to an already open instance of IE because we can not hard-code password and ID information. The site must be logged into and already at the page with the form before snagging it.)
There is another non-secure website built on the exact same frameset as our proprietary page that I can direct you too. This is the info I can so far assess:
Site: http://webcache.gmc-uk.org/gmclrmp_enu/start.swe
(I found this while searching for excel help on the frame name "_sweclient")
(The designer must have used the same software to create this page that my outfit used.)
Frame Hierarchy: "_sweclient" --> wasn't able to get far enough to find any more sub frames - but it used to be "_sweview"
Text Box element Name = 's_3_1_6_0'
Text Box element ID = "surname"
Whenever I try to snag the frame document it returns the top document. I had a working version a couple of years ago but they have updated the site and now I am hitting a brick wall.
Below is my code thus far. (I need to connect to an already open instance of IE because we can not hard-code password and ID information. The site must be logged into and already at the page with the form before snagging it.)
Code:
Sub getOpenIEbyTitleORurl()
'***************************************************************
' This subroutine grabs an already open instance of IE
' and assigns it as an internet Explorer object in order
' to fill out a form on the page by automation
' TEST WEB PAGE = http://webcache.gmc-uk.org/gmclrmp_enu/start.swe
'
' Text Box name = 's_3_1_6_0' Textbox id = "surname"
'***************************************************************
Dim Boolean_indicator As Boolean
Dim current_title As String
Dim current_url As String
Dim HTMLdoc As HTMLDocument
Dim IE As InternetExplorer
Dim objIterator As Object
Dim frameColl As FramesCollection
Boolean_indicator = False
Set objIterator = CreateObject("Shell.Application")
For x = 0 To objIterator.Windows.Count
On Error Resume Next
current_title = objIterator.Windows(x).Document.Title
current_url = objIterator.Windows(x).******************
If InStr(1, current_title, "Doctor Search") > 0 Then 'is this my webpage?
Set IE = objIterator.Windows(x)
Boolean_indicator = True
Exit For
End If
Next
If Boolean_indicator = False Then
MsgBox ("Your webpage is not open")
Else
MsgBox ("Your webpage is open...")
IE.Visible = True
End If
'***************************************************************
' The following section manipulates a frameset in order to
' control the form - which is on a sub-frame
' _sweclient --> _sweview --> ???
'***************************************************************
' FIRST ATTEMPT
Set HTMLdoc = IE.Document
Set second_level_Frame = HTMLdoc.getElementsByName("_sweclient")(0)
Set third_level_Frame = HTMLdoc.frames(0)
Debug.Print second_level_Frame.Document.body.innerhtml
' SECOND ATTEMPT
' Set HTMLdoc = theFrame.contentWindow.Document
'set third_level_Frame =
'Set second_level_Frame = IE.Document.frames("_sweclient")
' Debug.Print second_level_Frame.Document.body.innerhtml
' THIRD ATTEMPT
' Set frameColl = IE.Document.frames
' For Each frm In frameColl
' abc = frm.Name
' If frm.Name = "_sweclient" Then
' Set HTMLdoc = frm.Document
' Exit For
' End If
'
' Next frm
' FOURTH ATTEMPT
' Set acctInput = IE.Document.getElementById("surname")
' acctInput.Focus
' acctInput.Value = "12345"
Set HTMLdoc = Nothing
Set IE = Nothing
End Sub