dk1 Posted March 8, 2010 Share Posted March 8, 2010 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 More sharing options...
PsaltyDS Posted March 8, 2010 Share Posted March 8, 2010 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. 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 More sharing options...
dk1 Posted March 9, 2010 Author Share Posted March 9, 2010 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. 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 More sharing options...
PsaltyDS Posted March 9, 2010 Share Posted March 9, 2010 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. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now