W3C home > Mailing lists > Public > www-dom@w3.org > October to December 2008

Unable to get element of frames through VBScript

From: <Siddharth.Ughade@sungard.com>
Date: Wed, 8 Oct 2008 08:56:52 -0400
Message-ID: <A2C4F1E0787C8C48923879D6719061081BBE6D@VOO-EXCHANGE07.internal.sungard.corp>
To: <www-dom@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:59 GMT