Jump to content

IE Frames problem


Recommended Posts

Hello,

I'm trying to manipulate IE but the webapplication is using frames. All frames are *.ASP and Autoit doesn't seem to find any of the frames. All ASP pages are on the same server.

In addition it gives me errors.

$oIE = _IECreate ("[URL]")
_IELoadWait ($oIE)
$oFrame = _IEFrameGetObjByName ($oIE, "bottom")

When i try this (and i tried alot other constructions which are given in other topics on this forum) i get this error and till now i havent seen anyone(or topic) who can exactly explain why this occurs. Thats why i start this new topic about it.

If String($o_object.document.body.tagName) = "FRAMESET" Then

If String($o_object.document^ ERROR

I'm sure it occurs on the $oFrame line because when i leave it out it doesn't give any errors.

A side note, maybe an important one; i'm using IE6 and cannot upgrade it cause of restrictions on the network im on.

Can anyone help?

Link to comment
Share on other sites

Maybe also worth to mention :

<html>
<head>
  <title></title>
</head>
<NOSCRIPT>
<body bgcolor="#FFFFFF">
  <center>
  <h3><font color="#FF0000"> javascript!</font></h3>
  <br><br>
  <b></b>
  
  </center>
  
</body>
</NOSCRIPT>

<frameset name="frame" rows="80,*,30" cols="*" framespacing="false" border="0" frameborder="0"> 
 <frame name="top" src="top.asp" scrolling="no" noresize marginwidth="0" marginheight="0" target="main">
<frame name="main" src="main.asp" scrolling="auto">
<frame name="bottom" src="bottom.asp" scrolling="no" noresize marginwidth="0" marginheight="0" target="main">
</frameset>
<noframes>
<body bgcolor="#FFFFFF">
  <p>This page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</html>

As you can see the <FRAMESET tag is NOT in the body tag. Im not that into HTML but i dont know if that has influence.

Link to comment
Share on other sites

A common trap is taht there are more frames than you realize...

Try

$oIE = _IECreate ("")

ConsoleWrite(_IEDocReadHTML($oIE) & @CRLF)

to verify you are looking at the right source.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

So you say _IEFrameGetCollection($oIE) works?

Try this out :

$array=_IEFrameGetCollection($oIE)

For $element in $array

msgbox(0,$element.index,$element.name)

Next
In combination with the IsFrameSet this code below, (from the help) returns the correct number of frames, 3.

$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
If $iNumFrames > 0 Then
    If _IEIsFrameSet ($oIE) Then
        MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " frames in a FrameSet")
    Else
        MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " iFrames")
    EndIf
Else
    MsgBox(0, "Frame Info", "Page contains no frames")
EndIf

Your code does nothing, not even an error. It seems the for/next loop is made of 0 to 0 or something.

Edited by notsure
Link to comment
Share on other sites

If you dont see any msgbox it means that _IEFrameGetCollection($oIE) has returned nothing.Check if $array=0 . If so it means that _IEFrameGetCollection has returned nothing. Post the IE source code so we can see where is the problem.

Link to comment
Share on other sites

If you dont see any msgbox it means that _IEFrameGetCollection($oIE) has returned nothing.Check if $array=0 . If so it means that _IEFrameGetCollection has returned nothing. Post the IE source code so we can see where is the problem.

Yes, it seems like it returns nothing. But the odd thing is this:

$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
If $iNumFrames > 0 Then
    If _IEIsFrameSet ($oIE) Then
        MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " frames in a FrameSet")
    Else
        MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " iFrames")
    EndIf
Else
    MsgBox(0, "Frame Info", "Page contains no frames")
EndIf

When i remove the "IeFrameGetCollection" in the code above, the MsgBox here says "No Frames". But when i leave that line in, it says 3 frames. Kinda strange cause the $oFrames is not used anymore further in this little code above. I cant really think of a logical answer to that but either way, it needs to be in else the framecount does not work.

For the HTML source see the 2nd post in this topic.

Edit: also $array is not 0.. it looks like its just completely empty.

Edited by notsure
Link to comment
Share on other sites

$oIE=_IECreate("C:\Documents and Settings\test\Desktop\event_edit2.html")
$oDoc = _IEDocGetObj($oIE)
MsgBox(0,"","")
$oArray = $oDoc.getElementsByTagName("Frame")
for $element in $oArray
    MsgBox(0,"",$element.name)
next

The MsgBox(0,"","") is for pausing to deal with the security promt in IE that i get.

Also i created a html file on my desctop - just put the site address there

Edited by Juvigy
Link to comment
Share on other sites

$oIE=_IECreate("C:\Documents and Settings\test\Desktop\event_edit2.html")
$oDoc = _IEDocGetObj($oIE)
MsgBox(0,"","")
$oArray = $oDoc.getElementsByTagName("Frame")
for $element in $oArray
    MsgBox(0,"",$element.name)
next

The MsgBox(0,"","") is for pausing to deal with the security promt in IE that i get.

Also i created a html file on my desctop - just put the site address there

Ok this seems nice, atleast the script recognizes the frames. But how to encounter the page if i want to _IENavigate or encouter a control on the frame.

_IENavigate ($element, [URL])

Thats an invalid object type. Need something like $oIE?

Thanks for your help so far Juvigy, i really appreciate.

Link to comment
Share on other sites

You cant use that function on frames.Depending on what exactly you want you need another function. So far you have 3 objects in Array each representing one form element.

well i have a searchfield in the bottom frame.

<td>&nbsp;&nbsp;Search:&nbsp;&nbsp;<input type="text" name="strSearch" value="" size="25" MaxLength="150" ></td>

I need to use that searchfield, thats the whole reason why im trying to use the frame.

That means i have to search the Form and Submit button in the selected frame, bottom frame in this case.

Link to comment
Share on other sites

This is an input tag. You should use $oArray = $oDoc.getElementsByTagName("input") then identify the correct input like:

for $element in $oArray

if $element.name="strSearch" and MaxLength="150" then $element.value="Whatever you want"

next

Link to comment
Share on other sites

This is an input tag. You should use $oArray = $oDoc.getElementsByTagName("input") then identify the correct input like:

for $element in $oArray

if $element.name="strSearch" and MaxLength="150" then $element.value="Whatever you want"

next

May i ask where the .expressions come from? Where can i find those or are these the HTML value's?

$element.value is the same as the HTML "Value=' bla ' " ??

I mean, can i also use $element.MaxLength for instance? or where to find a list which .whatever's i can use behind $element? $element.whatever? :)

thx again.

Edited by notsure
Link to comment
Share on other sites

$element is a object from <input type="text" name="strSearch" value="" size="25" MaxLength="150" >

You can check all the details of the <input> tag on the microsoft site or HTML reference. As you can see there are name,size,type, etc.

Link to comment
Share on other sites

You cant use that function on frames.Depending on what exactly you want you need another function. So far you have 3 objects in Array each representing one form element.

Can't use _IENavigate on frames? You certainly can. There is a complication however... there is a "frame as element" that you cannot _IENavigate and that is found with something like getElelemntsByTagname and there is a "frame as window" that you can _IENavigate and that you obtain with the .frames collection or with _IEFrame* functions in IE.au3

Dale

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...