JohnOne Posted December 13, 2012 Posted December 13, 2012 (edited) Using Dale's IE UDFs.I navigate to a webpage, and in it there is a load of iframesThe frame I'm after has no name, but managed to get the frame with posted today (_IEFrameGetObjById). I needed to submit a form in that frame, but unfortunately it is cross domain.So now I'm needing to navigate to the url of that frame, except I don't know how to cleanly do it.At the moment I am using _StringBeween() on the whole document body to get the url I want Anyone put me straight on how to do this properly?This is all I get from the original source of page.<iframe id="framecfgyyr5dki870" src="http://www.sizzlewizzle.com/embed.php?file=nobby brown picks 3/his.nose.flv" width="530" height="410" frameborder="0" scrolling="no"></iframe>So instead of using stringbetween, I can get that url with the object reference to the iframe.here is the basic code.expandcollapse popup#include <IE.au3> $oIE = _IECreate("http://www.superhilariousvideosEx.com/the-big-nose-picking-incident") If Not IsObj($oIE) Then Exit MsgBox(0, "Error", "_IEAttach") EndIf $Frame = _IEFrameGetObjById($oIE, "framecfgyyr5dki870") If Not IsObj($Frame) Then Exit MsgBox(0, "Error", "_IEFrameGetObjById") EndIf ;I need to get the url in that frame tage above more cleanly than string functions here Func _IEFrameGetObjById(ByRef $o_object, $s_id) ;http://www.autoitscript.com/forum/topic/146633-how-to-access-iframes-based-on-id/ If Not IsObj($o_object) Then __IEErrorNotify("Error", "_IEFrameGetObjById", "$_IEStatus_InvalidDataType") Return SetError($_IEStatus_InvalidDataType, 1, 0) EndIf ; Local $oTemp, $oFrames If Not __IEIsObjType($o_object, "browserdom") Then __IEErrorNotify("Error", "_IEFrameGetObjById", "$_IEStatus_InvalidObjectType") Return SetError($_IEStatus_InvalidObjectType, 1, 0) EndIf If __IEIsObjType($o_object, "document") Then $oTemp = $o_object.parentWindow Else $oTemp = $o_object.document.parentWindow EndIf If _IEIsFrameSet($oTemp) Then $oFrames = _IETagNameGetCollection($oTemp, "frame") Else $oFrames = _IETagNameGetCollection($oTemp, "iframe") EndIf If $oFrames.length Then For $oFrame In $oFrames If $oFrame.id = $s_id Then Return SetError($_IEStatus_Success, 0, $oTemp.frames($s_id)) Next __IEErrorNotify("Warning", "_IEFrameGetObjById", "$_IEStatus_NoMatch", "No frames matching Id") Return SetError($_IEStatus_NoMatch, 2, 0) Else __IEErrorNotify("Warning", "_IEFrameGetObjById", "$_IEStatus_NoMatch", "No Frames found") Return SetError($_IEStatus_NoMatch, 2, 0) EndIf EndFunc ;==>_IEFrameGetObjByIdAppreciate any input/snidey remarks/whatever you have really. Edited December 13, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
jdelaney Posted December 14, 2012 Posted December 14, 2012 (edited) $sSRCValue = $oFrame.getattribute('src') Edited December 14, 2012 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Exit Posted December 14, 2012 Posted December 14, 2012 G:\Users\Exit>nslookup www.sizzlewizzle.com*** www.sizzlewizzle.com wurde von fritz.box nicht gefunden: Non-existent domain.G:\Users\Exit>nslookup www.superhilariousvideosEx*** www.superhilariousvideosEx wurde von fritz.box nicht gefunden: Non-existent domain.Can't test it. Non-existent domain. App: Au3toCmd UDF: _SingleScript()
GMK Posted December 14, 2012 Posted December 14, 2012 (edited) Does this example help? #include <IE.au3> $oIE = _IECreate("http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe") $oFrame = _IEGetObjById($oIE, "viewIFRAME") ConsoleWrite($oFrame.src & @CRLF) Edited December 14, 2012 by GMK
JohnOne Posted December 15, 2012 Author Posted December 15, 2012 On 12/14/2012 at 4:06 PM, 'jdelaney said: $sSRCValue = $oFrame.getattribute('src') On 12/14/2012 at 10:40 PM, 'GMK said: Does this example help? #include $oIE = _IECreate("http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe") $oFrame = _IEGetObjById($oIE, "viewIFRAME") ConsoleWrite($oFrame.src & @CRLF) Both tests throw com error "The requested action with this object has failed." AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
bogQ Posted December 15, 2012 Posted December 15, 2012 (edited) GMK example is working for me on other sites guess you cant share original url for testing? Edited December 15, 2012 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) Reveal hidden contents There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
JohnOne Posted December 15, 2012 Author Posted December 15, 2012 need to be logged in to try it on real url. I've sent you a PM if you get the chance to test it. Cheers. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted December 15, 2012 Author Posted December 15, 2012 It is my goal to do this whole process with trancexx' winhttp funtions in the end. But since I have no idea how to use it, I'm trying to do it with IE first to give me something to follow while trying to figure out winhttp method. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted December 15, 2012 Author Posted December 15, 2012 (edited) On 12/14/2012 at 10:40 PM, 'GMK said: Does this example help? #include <IE.au3> $oIE = _IECreate("http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe") $oFrame = _IEGetObjById($oIE, "viewIFRAME") ConsoleWrite($oFrame.src &amp; @CRLF) GMK this works fine, bogQ showed me that it was my code which was wrong. Thank you both. EDIT: jdelaney's code works also, cheers. Edited December 15, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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