Unable to get element of frames through VBScript

Hi All,

 

Through VBScript I am trying to automate one of the process.  I am using
IE 6+ as internet browser.

 

Following code I have used.

 

'**************** Code Start from here
**********************************

Dim ie

Set objIE = CreateObject("InternetExplorer.Application")

                        

objIE.Visible = True

objIE.Navigate2 url

WaitForLoad(ie)

 

objIE.Document.All("username").Value = UserName

objIE.Document.All("password").Value = Password

 

' Find a link to http://motevich.blogspot.com

Set objLink = GetLinkByHref(objIE, "javascript:submitForm();")

 

' If found, then click it

If (False = IsNull(objLink)) Then

            objLink.Click

            WaitForLoad(objIE)

End If

 

tagName = "IFRAME"

Set coll = objIE.Document.All.tags(tagName)

If coll.length > 0 Then

            For i = 0 To coll.length

                        If coll(i).getAttribute("name") =
"ContentIframe" Then

                                    coll(i).allowTransparency = True

                                    coll(i).style.backgroundColor =
"transparent"

                                    MsgBox
objIE.document.All("ContentIframe").Document.body.innerHTML

                        End If

            Next

End If

 

' Gets Link by 'href' attribute.

' Note: If your need, you can write another function - GetLinkByText

Private Function GetLinkByHref(ie, href)

            Dim Link

            

            For Each Link In ie.Document.Links

                        If Instr(LCase(Link.href), LCase(href)) > 0 Then

                                    Set GetLinkByHref = Link

                                    Exit Function

                        End If

            Next

 

            Set GetLinkByHref = Nothing

End Function

 

''******************* Code End here **********************************

For statement MsgBox
objIE.document.All("ContentIframe").Document.body.innerHTML  VBScript
displays "Access Denied" error.  Following are my question:

 

1] Is possible to get frame element through VBScript If yes then please
let me know correct way.  Here I am explicitly setting
"allowTransparency" property to true and "style.backgroundColor"
property to "transparent".  Is it correct way of doing it?

 

It would great if somebody helps me. 

 

Thanks

 

Siddharth  

 

 

Sr. QA Engineer 

 

 

 

Received on Wednesday, 8 October 2008 13:13:17 UTC