Jump to content

IE Frames Problem


gamba
 Share

Recommended Posts

Hi,

i have a problem using IE.au3. I would like to attach an open IE-Window an then use input an click some controls. But the first step fails. I cannot access the frames. So I wrote a very simple test-program but it also does not work. I get the right value for Number of frames, but a connot access the frame content.

My testprogram:

#include <IE.au3>

;$oIE= _IEAttach("New Site")
$oIE = _IECreate("C:\Data\Projects\xxx\Test.html")
if not isObj($oIE) or (@error <> 0) then MsgBox (0, "Error", "Browser not attached!" )

$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
msgbox(0,"Number of Frames", @extended)

$oFrame = _IEFrameGetCollection ($oIE, 2)
;$oFrame = _IEFrameGetObjByName ($oIE, String('Mainframe'))
if not isObj($oFrame) or (@error <> 0) then MsgBox (0, "Error", "not found!" )

$sText = _IEBodyReadHTML($oFrame)
msgbox(0,"", $sText)

HTML:

CODE
<html>

<head>

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">

<title>New Site</title>

<!--mstheme--><link rel="stylesheet" href="blue1010-28591.css">

<meta name="Microsoft Theme" content="blueprnt 1010, default">

<meta name="Microsoft Border" content="tlb, default">

</head>

<frameset rows="64,*" name="wurst">

<frame name="Banner" src="http://www.gmx.net" scrolling="no" noresize target="Inhalt">

<frameset cols="150,*">

<frame name="Inhalt" src="http://www.gmx.net" target="Hauptframe">

<frame name="Hauptframe" src="http://www.gmx.net" target="Inhalt">

</frameset>

<noframes>

<body>

<p>Diese Seite verwendet Frames. Frames werden von Ihrem Browser aber nicht

unterstützt.</p>

</body>

</noframes>

</frameset>

</html>

SciTE Output:

C:\Programme\AutoIt3\Include\IE.au3 (2112) : ==> The requested action with this object has failed.:

Return $o_object.document.body.innerHTML

Return $o_object.document^ ERROR

->10:22:26 AutoIT3.exe ended.rc:1

Thanks for any help

gamba

Link to comment
Share on other sites

You need to get src=address from the frame, since the frame itself does not contain data.

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
Link to comment
Share on other sites

You need to get src=address from the frame, since the frame itself does not contain data.

Clear. In the real case the frames get the content also via src (Intranet). How can I access controls within the differnet frames? All my trials fails.
Link to comment
Share on other sites

Ok, exact question:

I have the following HTML-Site and have to access the content of the frames.

HTML:

CODE
<!--- ..... -->

<FRAMESET border=0 name=mainframe frameSpacing=0 rows=60,*,20 frameBorder=0 onload=iO_onloadDispatcher()>

<FRAME name=DESKTOPMENU marginWidth=0 marginHeight=0 src="/xxx1/desktop/tt0&/DESKTOPMENU;jsessionid=0815" frameBorder=0 noResize scrolling=no>

<FRAME name=APPL marginWidth=0 marginHeight=0 src="/xxx1/desktop/tt0&/APPL;jsessionid=0815" frameBorder=0 noResize scrolling=no>

<FRAMESET border=0 name=subframe onload=iO_onloadDispatcher() cols=*,0,0,0,0,0,0,0,84>

<FRAME name=DESKTOPSTATUS marginWidth=0 marginHeight=0 src="/xxx1/desktop/tt0&/DESKTOPSTATUS;jsessionid=0815" noResize scrolling=no>

<FRAME name=UpdateManager marginWidth=0 marginHeight=0 src="/xxx1/resources/UpdateScript.html;jsessionid=0815" noResize scrolling=no>

<FRAME name=DESKTOPERROR marginWidth=0 marginHeight=0 src="/xxx1/desktop/tt0&/DESKTOPERROR;jsessionid=0815" noResize scrolling=no>

<FRAME name=DESKTOPPRINT marginWidth=0 marginHeight=0 src="/xxx1/desktop/tt0&/DESKTOPPRINT;jsessionid=0815" noResize scrolling=no>

<FRAME name=DESKTOPAPPLET marginWidth=0 marginHeight=0 src="/xxx1/desktop/tt0&/DESKTOPAPPLET;jsessionid=0815" noResize scrolling=no>

<FRAME name=DESKTOPPLUGINAPPLET marginWidth=0 marginHeight=0 src="/xxx1/desktop/tt0&/DESKTOPPLUGINAPPLET;jsessionid=0815" noResize scrolling=no>

<FRAME name=DESKTOPCTRLAPPLET marginWidth=0 marginHeight=0 src="/xxx1/desktop/tt0&/DESKTOPCTRLAPPLET;jsessionid=0815" noResize scrolling=no>

<FRAME name=DESKTOPINITAPPLET marginWidth=0 marginHeight=0 src="/xxx1/desktop/tt0&/DESKTOPINITAPPLET;jsessionid=0815" noResize scrolling=no>

<FRAME name=DESKTOPLOAD marginWidth=0 marginHeight=0 src="/xxx1/desktop/tt0&/DESKTOPLOAD;jsessionid=0815" noResize scrolling=no>

</FRAMESET>

</FRAMESET>

</HTML>

Thanks for any help.

gamba

Link to comment
Share on other sites

One common cause for this is cross-site frame security restrictions. I assume that /xxx1/ is replacing something else.

Suggest you add _IEErrorHandlerRegister() after your IE.au3 include and then show what messages you get to the SciTe console.

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

One common cause for this is cross-site frame security restrictions. I assume that /xxx1/ is replacing something else.

Suggest you add _IEErrorHandlerRegister() after your IE.au3 include and then show what messages you get to the SciTe console.

Dale

Hi Dale,

thank you for the hint. Right, I replaced the real content with "xxx1". Now I have added _IEErrorHandlerRegister(). The result was:

----> $ErrorScriptLine = 2214

----> $ErrorNumber = -2147352567

----> $ErrorNumberHEX = -2147352567

----> $ErrorDescription = Access denied

----> $ErrorWinDescription = Access denied

----> $ErrorSource =

----> $ErrorHelpFile = C:\WINDOWS\system32\mshtml.hlp

----> $ErrorHelpContext = 0

----> $ErrorLastDLLError = 0

This error is a result of _IEFrameGetCollection($oIE, 6) (also with all other frames 1-10). In some frames I can show the source-code with right mouse-click. There is no possibility to access the content? Any Idea?

Thanks again.

Gamba

Link to comment
Share on other sites

Unfortunately, browsers don't allow scripting accross frames in different domains.

Your recourse is to get the source URL of the target frame (or a higher level frame in the nesting if it is the same domain as your target frame) and then open that URL is a new window.

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

Hi Dale,

sorry, I'm not so familiar with that and I don't want to waste your time, but I haven't understood yet. I'm not sure that scripting accross frames in different domains is necessary. Used domains seems to be the same.

The Intranet of our customer is a black-box (for us). We have no access and no documentation. The customer would like to have an automatic input of only one value out of an excel-sheet. Then the script has to navigate four browser-sites.

The browser needs the html source-code and gets it (in case of frames) from "src=...". The source-code of the content of some frames is visible. If I can show the source-code, why I can't access the elements? The whole content of all frames is visible but not accessible?

Is there definitely no chance to access elements of the frames?

Thanks for your patience.

Gamba

Link to comment
Share on other sites

Is there definitely no chance to access elements of the frames?

Again, your recourse is to get the source URL of the target frame (or a higher level frame in the nesting if it is the same domain as your target frame) and then open that URL is a new window.

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

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...