Sign in to follow this  
Followers 0
fdecourt

Retreive all the "subframes" of the "subframes" of a HTML page

5 posts in this topic

Hi,

I am trying to automate some input in a business application (SAP BO) through Internet Explorer 7

I am blocked quite quickly !

I need to click on links that are deep inside the page.

On the page, there is 3 frames with many sub frames

-Frame1

-Frame2

--Frame2.1

--Frame2.2

---Frame2.2.1

---Frame2.2.2

---Frame2.2.3

----Frame2.2.3.1

----Frame2.2.3.2

-----Frame2.2.3.2.1

------Frame2.2.3.2.1.1

-------Frame2.2.3.2.1.1.1 <<<< I want to go on this frame !

------Frame2.2.3.2.1.2

-----Frame2.2.3.2.2

----Frame2.2.3.3

---Frame2.2.4

--Frame2.3

-Frame3

I am not able to navigate through the second level, and I need to go to the seventh level !!!!!

On the frame : "-------Frame2.2.3.2.1.1.1" there is some forms and links I need to click. But other frames needed to be loaded, if not, some functions won't work, so I need to load everything !

To list the first level, I am using the following code, found here :

ConsoleWrite ("Frame List Start" & @CRLF)

Local $oFrames = _IEFrameGetCollection($oIE)

$oFrames = _IEFrameGetCollection ($oIE)

$iNumFrames = @extended

For $i = 0 to ($iNumFrames - 1)

$oFrame = _IEFrameGetCollection ($oIE, $i)

$sHTML = _IEBodyReadHTML ($oFrame)

ConsoleWrite ($oFrame.name & @CRLF)

Next

ConsoleWrite ("Frame List End" & @CRLF)

Thanks a lot for your help, helping me to navigate through many sub frames

Regards,

PS : Sorry the URL won't be available, and I can't post any code !

Share this post


Link to post
Share on other sites



muttley That's a lot of Frames...see if this works:

$oFrame2  = _IEFrameGetCollection($oIE, 1)
$oFrame2_2 = _IEFrameGetCollection($oFrame2, 1)
$oFrame2_2_3 = _IEFrameGetCollection($oFrame2_2, 2)
$oFrame2_2_3_2 = _IEFrameGetCollection($oFrame2_2_3, 1)
$oFrame2_2_3_2_1 = _IEFrameGetCollection($oFrame2_2_3_2, 0)
$oFrame2_2_3_2_1_1 = _IEFrameGetCollection($oFrame2_2_3_2_1, 0)
$oFrame2_2_3_2_1_1_1 = _IEFrameGetCollection($oFrame2_2_3_2_1, 0)
ConsoleWrite("$oFrame2_2_3_2_1_1_1 Name: " & $oFrame2_2_3_2_1_1_1.name & @CRLF)

Share this post


Link to post
Share on other sites

Hi,

Thanks for your answer.

I can go to through the two first levels, then for the third one with the following errors code :

--> COM Error Encountered in NavigateIE.au3

----> $IEComErrorScriptline = 32

----> $IEComErrorNumberHex = 80020009

----> $IEComErrorNumber = -2147352567

----> $IEComErrorWinDescription = Accès refusé.

----> $IEComErrorDescription = Accès refusé.

----> $IEComErrorSource =

----> $IEComErrorHelpFile = C:\Windows\System32\mshtml.hlp

----> $IEComErrorHelpContext = 0

----> $IEComErrorLastDllError = 0

I highly suspect a COM security error..... Does anybody know any way to bypass that ?

Thanks and best regards

Share this post


Link to post
Share on other sites

The frame you last try to drill into is breaking cross-domain scripting security rules. Best you can do is to figure out the URL of that frame and start over with that URL opened in a new browser window and then keep drilling.

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

Share this post


Link to post
Share on other sites

Hi DaleHolm,

This is an old topic, but even if I found a solution, it is not satisfactory. With the following code, I am able to navigate to the frame I want, even if I have to go through many of them. The array oArguments list the position of each frame inside the previous frame (look at the exemple on the first post, knowing that frame index start at 0 (Frame2.2.3.2.1.1.1)).

So, being ableto access all the sub frame with this solution make me think that's it is possible to avoid the COM security error.

The problem with that code is that the user needs to go through the HTML code (which can be the hell).

I tried to create a recursive function to go through all the frames, but I was completely unable to do it ! I am not familiar at all with this recursive stuff !

With that solution, we won't have to check the HTML code. I simple function will go through all the code source of each frame, and check if the link, button, form or whatever exists, if so, it will work in that frame to do what I want.

Could you help me ?

Local $oArguments[4] = [1, 1, 2, 0, 0, 0]
$myFinalFrame = getMyFrame($oIE, $oArguments, 4)
Func getMyFrame($obj_IE, $oArgs, $combien)
$oFrameTmp = _IEAction2($obj_IE, $oArgs[0])
For $r = 1 To  ubound($oArguments) - 1
  $oFrameTmp =  _IEAction2($oFrameTmp, $oArgs[$r])
Next
Return $oFrameTmp
EndFunc
Func _IEAction2($oLink, $monAction)
   $resultat_tmp = 0
   While $resultat_tmp = 0
    $erreur_1 = _IEFrameGetCollection($oLink, $monAction)
    If @error = 0 Then
     $resultat_tmp = @extended
    EndIf
    Sleep(250)
   WEnd
   Return $erreur_1
EndFunc

Thanks an d best regards,

F.

Share this post


Link to post
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
Sign in to follow this  
Followers 0