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

RE: Unable to get element of frames through VBScript

From: <Siddharth.Ughade@sungard.com>
Date: Wed, 8 Oct 2008 09:35:05 -0400
Message-ID: <A2C4F1E0787C8C48923879D6719061081BBE8D@VOO-EXCHANGE07.internal.sungard.corp>
To: <joao.eiras@gmail.com>
CC: <www-dom@w3.org>

Hi Joao,

Thanks for the reply.  But I have use iframe.document but it also gives "Access Denied".  How to get access to Iframe.document content?



Siddharth  
Sr, QA Engineer 
SunGard 

-----Original Message-----
From: Joćo Eiras [mailto:joao.eiras@gmail.com] 
Sent: Wednesday, October 08, 2008 6:51 PM
To: Ughade, Siddharth
Cc: www-dom@w3.org
Subject: Re: Unable to get element of frames through VBScript

Hi !
First, you're using unsupported IE proprietary DOM (document.all) and
ActiveX so you are asking your questions in the wrong place. Second,
no W3C DOM specification defines any vbscript binding, which means
that that's undefined territory.

But, iframe.document in IE will return the equivalent of ownerDocument
in the DOM specification. What you really want for IE is
iframe.contentWindow.document.

Either way, you thrive to make your application interoperable and
accessible to anyone, if that's a requirement, by using javascript and
relying on the DOM specifications.

Cheers.

On Wed, Oct 8, 2008 at 1:56 PM,  <Siddharth.Ughade@sungard.com> wrote:
> 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:34:18 GMT

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