Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

iFrame

$
0
0
Using Dale's IE UDFs.

I navigate to a webpage, and in it there is a load of iframes
The frame I'm after has no name, but managed to get the frame with this UDF 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.

[ autoit ]         
#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   ;==>_IEFrameGetObjById

Appreciate any input/snidey remarks/whatever you have really.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>