Jump to content

_IELinkGetCollection doesn't work for a frame


 Share

Recommended Posts

Hello,

I have been trying to get all the links in a particular frame using _IELinkGetCollection().

I'm attaching the piece of code which does the same.

$oLinks1=_IELinkGetCollection ($contentFrame)
For $oLink2 In $oLinks1
 If IsObj($oLink2) then 
    _IEAction($oLink2,"click")
 endif
next

With this i get the foll error:

"the requested action with this object has failed"

Does anyone know what the problem could be?

Link to comment
Share on other sites

Is it an iFrame, with sub-frames under that? You may not have drilled far enough down yet to get the link elements. Check out the links with DebugBar or another DOM inspector to see how deep they are buried.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Is it an iFrame, with sub-frames under that? You may not have drilled far enough down yet to get the link elements. Check out the links with DebugBar or another DOM inspector to see how deep they are buried.

:mellow:

I did try that... there are no more frames...

the actual code is this. Basically it crawls through all the links and then clicks them. The code works fine till a certain point and then it gets stuck and the throwes the error. This problem is not seen every time i run the code. Its intermittent and therefore i don't know where the exactly the problem is. Is it a bug in the code or is there a problem with the exchange server that i'm trying to crawl

oLinks1=_IELinkGetCollection ($contentFrame)
$iNumLinks1 = @extended
If @extended <> 0 Then
   For $oLink2 In $oLinks1
    If IsObj($oLink2) then 
        If StringInStr($oLink2.id,"new", 0) Or StringInStr($oLink2.id,"logoff", 0) Then
        ContinueLoop
    Else
            _IEAction($oLink2,"click")
        _IELoadWait($oIE)
    EndIf
    
   Next 
EndIf
Link to comment
Share on other sites

If clicking any of those links navigates the page somewhere else, or that or something else reloads\refreshes the page, then the objects become invalid and have to be retrieved over again. That would invalidate the objects in the $oLinks1 collection that haven't been used yet.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...