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:22:00 UTC