Zohar Posted November 24, 2012 Posted November 24, 2012 (edited) HiLet's say we have a WebPage, with an Image in it<IMG SRC="http://domain.com/folder/image.jpg">How can I get the SRC Parameter from it?Thank youZohar Edited December 3, 2012 by Zohar
water Posted November 24, 2012 Posted November 24, 2012 If you use Internet Explorer you can try the IE UDF that comes with AutoIt. Function _IEImgGetCollection returns a collection or single IMG object.The example in the help file shows how to access the src property. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
stormbreaker Posted November 24, 2012 Posted November 24, 2012 Or, you could download the source and then use _StringBetween(). For me, its very handy. ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1
Zohar Posted November 24, 2012 Author Posted November 24, 2012 (edited) Hi WaterThank you very much..Yes I am using IE and IE.udf,However the way I get the IMG object is different..I get it via the ActiveElement..Like this:Local $IMG =$oIE.document.activeElementHowever when I then try to do:MsgBox(0,"",$IMG.src)It doesn't work Please note that for having the IMG be the ActiveElement,you need to RightClick it, and then press ESC so the ContextMenu will disappear.It is then the ActiveElement.. Edited November 24, 2012 by Zohar
DaleHohm Posted November 26, 2012 Posted November 26, 2012 Have you checked to see if your $IMG is actually an IMG object (that would have a src property)? Use ObjName or _IEPropertyGet($IMG, "outerhtml") 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
jdelaney Posted November 26, 2012 Posted November 26, 2012 (edited) consolewrite ( $IMG.getAttribute('src') & @crlf ) or, you can use .attributes, and loop through the collection returned, but that's a lot of additional steps. Edited November 26, 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.
Zohar Posted November 28, 2012 Author Posted November 28, 2012 (edited) Or, you could download the source and then use _StringBetween(). For me, its very handy. Hi MKISH, somehow I missed your comment last time.. What you say will work, but I prefer to use the DOM object model, like I do for other stuff in the HTML page.. Have you checked to see if your $IMG is actually an IMG object (that would have a src property)? Use ObjName or _IEPropertyGet($IMG, "outerhtml") Dale Hi Dale As an example, I used my script on Google's main page. It always has a picture there, and it's an IMG.. When I RightClick the Image(to make it focussed), then press ESC(to get rid of the ContextMenu), and then run this: Local $IMG =$oIE.document.activeElement MsgBox(0,"",$IMG.innerHTML) I get this: From this, I learn that: 1) I am successfully making the Image the ActiveObject, when I RightClick+ESC it. 2) The Object is indeed an IMG (and it has a SRC..) And yet, When doing MsgBox(0,"",$IMG.src) It doesn't work, and displays what I showed in the previous post.. consolewrite ( $IMG.getAttribute('src') & @crlf ) or, you can use .attributes, and loop through the collection returned, but that's a lot of additional steps. Hi jdelaney When I do MsgBox(0,"",$IMG.getAttribute("src")) I get Why is the SRC so elusive here? Edited November 28, 2012 by Zohar
Danp2 Posted November 28, 2012 Posted November 28, 2012 Try the following and you will most likely see that you have captured something other than an image.MsgBox(0,"",$IMG.nodeName) Latest Webdriver UDF Release Webdriver Wiki FAQs
jdelaney Posted November 28, 2012 Posted November 28, 2012 (edited) works fine for me: #include <IE.au3> $oIE = _IECreate ( "www.google.com", True ) $oImages = _IEImgGetCollection ( $oIE ) For $oImage In $oImages ConsoleWrite ( $oImage.getAttribute('src') & @CRLF ) Next output: /images/icons/product/chrome-48.png /images/srpr/logo3w.png /images/mgyhp_sm.png Using the attributes #include <IE.au3> $oIE = _IECreate ( "www.google.com", True ) _IELoadWait ( $oIE ) $oImages = _IEImgGetCollection ( $oIE ) $iCounter = 1 For $oImage In $oImages $oAttributes = $oImage.Attributes For $oAttribute in $oAttributes ConsoleWrite ( "Image=[" & $iCounter & "]; Attribute=[" & $oAttribute.NodeName & "], AttributeValue=[" & $oAttribute.NodeValue & "]" & @CRLF ) ;ConsoleWrite ( $oImage.getAttribute("src") & @CRLF ) Next $iCounter+=1 Next output: expandcollapse popupImage=[1]; Attribute=[onresizeend], AttributeValue=[0] Image=[1]; Attribute=[onrowenter], AttributeValue=[0] Image=[1]; Attribute=[aria-haspopup], AttributeValue=[0] Image=[1]; Attribute=[ondragleave], AttributeValue=[0] Image=[1]; Attribute=[oncut], AttributeValue=[0] Image=[1]; Attribute=[onbeforepaste], AttributeValue=[0] Image=[1]; Attribute=[ondragover], AttributeValue=[0] Image=[1]; Attribute=[onbeforecopy], AttributeValue=[0] Image=[1]; Attribute=[aria-disabled], AttributeValue=[0] Image=[1]; Attribute=[onpage], AttributeValue=[0] Image=[1]; Attribute=[onbeforeactivate], AttributeValue=[0] Image=[1]; Attribute=[accessKey], AttributeValue=[0] Image=[1]; Attribute=[onfocusin], AttributeValue=[0] Image=[1]; Attribute=[onbeforeeditfocus], AttributeValue=[0] Image=[1]; Attribute=[oncontrolselect], AttributeValue=[0] Image=[1]; Attribute=[aria-hidden], AttributeValue=[0] Image=[1]; Attribute=[onloadedmetadata], AttributeValue=[0] Image=[1]; Attribute=[onblur], AttributeValue=[0] Image=[1]; Attribute=[hideFocus], AttributeValue=[0] Image=[1]; Attribute=[style], AttributeValue=[0] Image=[1]; Attribute=[oninput], AttributeValue=[0] Image=[1]; Attribute=[onbeforedeactivate], AttributeValue=[0] Image=[1]; Attribute=[dir], AttributeValue=[0] Image=[1]; Attribute=[aria-expanded], AttributeValue=[0] Image=[1]; Attribute=[onkeydown], AttributeValue=[0] Image=[1]; Attribute=[ondragstart], AttributeValue=[0] Image=[1]; Attribute=[onscroll], AttributeValue=[0] Image=[1]; Attribute=[onpropertychange], AttributeValue=[0] Image=[1]; Attribute=[ondragenter], AttributeValue=[0] Image=[1]; Attribute=[id], AttributeValue=[0] Image=[1]; Attribute=[aria-level], AttributeValue=[0] Image=[1]; Attribute=[onrowsinserted], AttributeValue=[0] Image=[1]; Attribute=[onmovestart], AttributeValue=[0] Image=[1]; Attribute=[onabort], AttributeValue=[0] Image=[1]; Attribute=[oncanplay], AttributeValue=[0] Image=[1]; Attribute=[lang], AttributeValue=[0] Image=[1]; Attribute=[onmouseup], AttributeValue=[0] Image=[1]; Attribute=[aria-busy], AttributeValue=[0] Image=[1]; Attribute=[oncontextmenu], AttributeValue=[0] Image=[1]; Attribute=[onsuspend], AttributeValue=[0] Image=[1]; Attribute=[onpause], AttributeValue=[0] Image=[1]; Attribute=[language], AttributeValue=[0] Image=[1]; Attribute=[onratechange], AttributeValue=[0] Image=[1]; Attribute=[onstalled], AttributeValue=[0] Image=[1]; Attribute=[dataSrc], AttributeValue=[0] Image=[1]; Attribute=[implementation], AttributeValue=[0] Image=[1]; Attribute=[onerror], AttributeValue=[0] Image=[1]; Attribute=[onbeforeupdate], AttributeValue=[0] Image=[1]; Attribute=[onreadystatechange], AttributeValue=[0] Image=[1]; Attribute=[onload], AttributeValue=[0] Image=[1]; Attribute=[onresize], AttributeValue=[0] Image=[1]; Attribute=[aria-checked], AttributeValue=[0] Image=[1]; Attribute=[aria-readonly], AttributeValue=[0] Image=[1]; Attribute=[oncopy], AttributeValue=[0] Image=[1]; Attribute=[onchange], AttributeValue=[0] Image=[1]; Attribute=[onselectstart], AttributeValue=[0] Image=[1]; Attribute=[onmove], AttributeValue=[0] Image=[1]; Attribute=[ondragend], AttributeValue=[0] Image=[1]; Attribute=[onrowexit], AttributeValue=[0] Image=[1]; Attribute=[aria-secret], AttributeValue=[0] Image=[1]; Attribute=[onactivate], AttributeValue=[0] Image=[1]; Attribute=[onloadeddata], AttributeValue=[0] Image=[1]; Attribute=[onseeking], AttributeValue=[0] Image=[1]; Attribute=[class], AttributeValue=[0] Image=[1]; Attribute=[onfocus], AttributeValue=[0] Image=[1]; Attribute=[onmouseover], AttributeValue=[0] Image=[1]; Attribute=[onseeked], AttributeValue=[0] Image=[1]; Attribute=[oncanplaythrough], AttributeValue=[0] Image=[1]; Attribute=[onsubmit], AttributeValue=[0] Image=[1]; Attribute=[onmousemove], AttributeValue=[0] Image=[1]; Attribute=[title], AttributeValue=[0] Image=[1]; Attribute=[role], AttributeValue=[0] Image=[1]; Attribute=[dataFld], AttributeValue=[0] Image=[1]; Attribute=[onfocusout], AttributeValue=[0] Image=[1]; Attribute=[onfilterchange], AttributeValue=[0] Image=[1]; Attribute=[disabled], AttributeValue=[0] Image=[1]; Attribute=[onreset], AttributeValue=[0] Image=[1]; Attribute=[aria-posinset], AttributeValue=[0] Image=[1]; Attribute=[ondrop], AttributeValue=[0] Image=[1]; Attribute=[ondblclick], AttributeValue=[0] Image=[1]; Attribute=[onrowsdelete], AttributeValue=[0] Image=[1]; Attribute=[onplay], AttributeValue=[0] Image=[1]; Attribute=[tabIndex], AttributeValue=[0] Image=[1]; Attribute=[onkeypress], AttributeValue=[0] Image=[1]; Attribute=[aria-relevant], AttributeValue=[0] Image=[1]; Attribute=[onlosecapture], AttributeValue=[0] Image=[1]; Attribute=[aria-live], AttributeValue=[0] Image=[1]; Attribute=[ondeactivate], AttributeValue=[0] Image=[1]; Attribute=[aria-labelledby], AttributeValue=[0] Image=[1]; Attribute=[aria-pressed], AttributeValue=[0] Image=[1]; Attribute=[ondatasetchanged], AttributeValue=[0] Image=[1]; Attribute=[ondataavailable], AttributeValue=[0] Image=[1]; Attribute=[aria-invalid], AttributeValue=[0] Image=[1]; Attribute=[onafterupdate], AttributeValue=[0] Image=[1]; Attribute=[onmousewheel], AttributeValue=[0] Image=[1]; Attribute=[onkeyup], AttributeValue=[0] Image=[1]; Attribute=[aria-valuenow], AttributeValue=[0] Image=[1]; Attribute=[aria-selected], AttributeValue=[0] Image=[1]; Attribute=[onmouseout], AttributeValue=[0] Image=[1]; Attribute=[aria-owns], AttributeValue=[0] Image=[1]; Attribute=[onvolumechange], AttributeValue=[0] Image=[1]; Attribute=[aria-valuemax], AttributeValue=[0] Image=[1]; Attribute=[onplaying], AttributeValue=[0] Image=[1]; Attribute=[onmoveend], AttributeValue=[0] Image=[1]; Attribute=[dataFormatAs], AttributeValue=[0] Image=[1]; Attribute=[ontimeupdate], AttributeValue=[0] Image=[1]; Attribute=[oncellchange], AttributeValue=[0] Image=[1]; Attribute=[onloadstart], AttributeValue=[0] Image=[1]; Attribute=[aria-valuemin], AttributeValue=[0] Image=[1]; Attribute=[onlayoutcomplete], AttributeValue=[0] Image=[1]; Attribute=[onhelp], AttributeValue=[0] Image=[1]; Attribute=[onerrorupdate], AttributeValue=[0] Image=[1]; Attribute=[contentEditable], AttributeValue=[0] Image=[1]; Attribute=[ondurationchange], AttributeValue=[0] Image=[1]; Attribute=[onmousedown], AttributeValue=[0] Image=[1]; Attribute=[onwaiting], AttributeValue=[0] Image=[1]; Attribute=[aria-setsize], AttributeValue=[0] Image=[1]; Attribute=[onpaste], AttributeValue=[0] Image=[1]; Attribute=[onmouseleave], AttributeValue=[0] Image=[1]; Attribute=[onselect], AttributeValue=[0] Image=[1]; Attribute=[onclick], AttributeValue=[0] Image=[1]; Attribute=[ondrag], AttributeValue=[0] Image=[1]; Attribute=[aria-controls], AttributeValue=[0] Image=[1]; Attribute=[onresizestart], AttributeValue=[0] Image=[1]; Attribute=[aria-flowto], AttributeValue=[0] Image=[1]; Attribute=[ondatasetcomplete], AttributeValue=[0] Image=[1]; Attribute=[aria-required], AttributeValue=[0] Image=[1]; Attribute=[onended], AttributeValue=[0] Image=[1]; Attribute=[onemptied], AttributeValue=[0] Image=[1]; Attribute=[aria-describedby], AttributeValue=[0] Image=[1]; Attribute=[onmouseenter], AttributeValue=[0] Image=[1]; Attribute=[onbeforecut], AttributeValue=[0] Image=[1]; Attribute=[aria-activedescendant], AttributeValue=[0] Image=[1]; Attribute=[aria-multiselectable], AttributeValue=[0] Image=[1]; Attribute=[onprogress], AttributeValue=[0] Image=[1]; Attribute=[border], AttributeValue=[0] Image=[1]; Attribute=[lowsrc], AttributeValue=[0] Image=[1]; Attribute=[name], AttributeValue=[0] Image=[1]; Attribute=[hspace], AttributeValue=[0] Image=[1]; Attribute=[alt], AttributeValue=[0] Image=[1]; Attribute=[vspace], AttributeValue=[0] Image=[1]; Attribute=[align], AttributeValue=[0] Image=[1]; Attribute=[loop], AttributeValue=[0] Image=[1]; Attribute=[src], AttributeValue=[/images/icons/product/chrome-48.png] Image=[1]; Attribute=[isMap], AttributeValue=[0] Image=[1]; Attribute=[width], AttributeValue=[0] Image=[1]; Attribute=[start], AttributeValue=[0] Image=[1]; Attribute=[vrml], AttributeValue=[0] Image=[1]; Attribute=[dynsrc], AttributeValue=[0] Image=[1]; Attribute=[longDesc], AttributeValue=[0] Image=[1]; Attribute=[height], AttributeValue=[0] Image=[1]; Attribute=[useMap], AttributeValue=[0] Image=[2]; Attribute=[onresizeend], AttributeValue=[0] Image=[2]; Attribute=[onrowenter], AttributeValue=[0] Image=[2]; Attribute=[aria-haspopup], AttributeValue=[0] Image=[2]; Attribute=[ondragleave], AttributeValue=[0] Image=[2]; Attribute=[oncut], AttributeValue=[0] Image=[2]; Attribute=[onbeforepaste], AttributeValue=[0] Image=[2]; Attribute=[ondragover], AttributeValue=[0] Image=[2]; Attribute=[onbeforecopy], AttributeValue=[0] Image=[2]; Attribute=[aria-disabled], AttributeValue=[0] Image=[2]; Attribute=[onpage], AttributeValue=[0] Image=[2]; Attribute=[onbeforeactivate], AttributeValue=[0] Image=[2]; Attribute=[accessKey], AttributeValue=[0] Image=[2]; Attribute=[onfocusin], AttributeValue=[0] Image=[2]; Attribute=[onbeforeeditfocus], AttributeValue=[0] Image=[2]; Attribute=[oncontrolselect], AttributeValue=[0] Image=[2]; Attribute=[aria-hidden], AttributeValue=[0] Image=[2]; Attribute=[onloadedmetadata], AttributeValue=[0] Image=[2]; Attribute=[onblur], AttributeValue=[0] Image=[2]; Attribute=[hideFocus], AttributeValue=[0] Image=[2]; Attribute=[style], AttributeValue=[padding-top: 112px;] Image=[2]; Attribute=[oninput], AttributeValue=[0] Image=[2]; Attribute=[onbeforedeactivate], AttributeValue=[0] Image=[2]; Attribute=[dir], AttributeValue=[0] Image=[2]; Attribute=[aria-expanded], AttributeValue=[0] Image=[2]; Attribute=[onkeydown], AttributeValue=[0] Image=[2]; Attribute=[ondragstart], AttributeValue=[0] Image=[2]; Attribute=[onscroll], AttributeValue=[0] Image=[2]; Attribute=[onpropertychange], AttributeValue=[0] Image=[2]; Attribute=[ondragenter], AttributeValue=[0] Image=[2]; Attribute=[id], AttributeValue=[hplogo] Image=[2]; Attribute=[aria-level], AttributeValue=[0] Image=[2]; Attribute=[onrowsinserted], AttributeValue=[0] Image=[2]; Attribute=[onmovestart], AttributeValue=[0] Image=[2]; Attribute=[onabort], AttributeValue=[0] Image=[2]; Attribute=[oncanplay], AttributeValue=[0] Image=[2]; Attribute=[lang], AttributeValue=[0] Image=[2]; Attribute=[onmouseup], AttributeValue=[0] Image=[2]; Attribute=[aria-busy], AttributeValue=[0] Image=[2]; Attribute=[oncontextmenu], AttributeValue=[0] Image=[2]; Attribute=[onsuspend], AttributeValue=[0] Image=[2]; Attribute=[onpause], AttributeValue=[0] Image=[2]; Attribute=[language], AttributeValue=[0] Image=[2]; Attribute=[onratechange], AttributeValue=[0] Image=[2]; Attribute=[onstalled], AttributeValue=[0] Image=[2]; Attribute=[dataSrc], AttributeValue=[0] Image=[2]; Attribute=[implementation], AttributeValue=[0] Image=[2]; Attribute=[onerror], AttributeValue=[0] Image=[2]; Attribute=[onbeforeupdate], AttributeValue=[0] Image=[2]; Attribute=[onreadystatechange], AttributeValue=[0] Image=[2]; Attribute=[onload], AttributeValue=[window.lol&&lol()] Image=[2]; Attribute=[onresize], AttributeValue=[0] Image=[2]; Attribute=[aria-checked], AttributeValue=[0] Image=[2]; Attribute=[aria-readonly], AttributeValue=[0] Image=[2]; Attribute=[oncopy], AttributeValue=[0] Image=[2]; Attribute=[onchange], AttributeValue=[0] Image=[2]; Attribute=[onselectstart], AttributeValue=[0] Image=[2]; Attribute=[onmove], AttributeValue=[0] Image=[2]; Attribute=[ondragend], AttributeValue=[0] Image=[2]; Attribute=[onrowexit], AttributeValue=[0] Image=[2]; Attribute=[aria-secret], AttributeValue=[0] Image=[2]; Attribute=[onactivate], AttributeValue=[0] Image=[2]; Attribute=[onloadeddata], AttributeValue=[0] Image=[2]; Attribute=[onseeking], AttributeValue=[0] Image=[2]; Attribute=[class], AttributeValue=[0] Image=[2]; Attribute=[onfocus], AttributeValue=[0] Image=[2]; Attribute=[onmouseover], AttributeValue=[0] Image=[2]; Attribute=[onseeked], AttributeValue=[0] Image=[2]; Attribute=[oncanplaythrough], AttributeValue=[0] Image=[2]; Attribute=[onsubmit], AttributeValue=[0] Image=[2]; Attribute=[onmousemove], AttributeValue=[0] Image=[2]; Attribute=[title], AttributeValue=[0] Image=[2]; Attribute=[role], AttributeValue=[0] Image=[2]; Attribute=[dataFld], AttributeValue=[0] Image=[2]; Attribute=[onfocusout], AttributeValue=[0] Image=[2]; Attribute=[onfilterchange], AttributeValue=[0] Image=[2]; Attribute=[disabled], AttributeValue=[0] Image=[2]; Attribute=[onreset], AttributeValue=[0] Image=[2]; Attribute=[aria-posinset], AttributeValue=[0] Image=[2]; Attribute=[ondrop], AttributeValue=[0] Image=[2]; Attribute=[ondblclick], AttributeValue=[0] Image=[2]; Attribute=[onrowsdelete], AttributeValue=[0] Image=[2]; Attribute=[onplay], AttributeValue=[0] Image=[2]; Attribute=[tabIndex], AttributeValue=[0] Image=[2]; Attribute=[onkeypress], AttributeValue=[0] Image=[2]; Attribute=[aria-relevant], AttributeValue=[0] Image=[2]; Attribute=[onlosecapture], AttributeValue=[0] Image=[2]; Attribute=[aria-live], AttributeValue=[0] Image=[2]; Attribute=[ondeactivate], AttributeValue=[0] Image=[2]; Attribute=[aria-labelledby], AttributeValue=[0] Image=[2]; Attribute=[aria-pressed], AttributeValue=[0] Image=[2]; Attribute=[ondatasetchanged], AttributeValue=[0] Image=[2]; Attribute=[ondataavailable], AttributeValue=[0] Image=[2]; Attribute=[aria-invalid], AttributeValue=[0] Image=[2]; Attribute=[onafterupdate], AttributeValue=[0] Image=[2]; Attribute=[onmousewheel], AttributeValue=[0] Image=[2]; Attribute=[onkeyup], AttributeValue=[0] Image=[2]; Attribute=[aria-valuenow], AttributeValue=[0] Image=[2]; Attribute=[aria-selected], AttributeValue=[0] Image=[2]; Attribute=[onmouseout], AttributeValue=[0] Image=[2]; Attribute=[aria-owns], AttributeValue=[0] Image=[2]; Attribute=[onvolumechange], AttributeValue=[0] Image=[2]; Attribute=[aria-valuemax], AttributeValue=[0] Image=[2]; Attribute=[onplaying], AttributeValue=[0] Image=[2]; Attribute=[onmoveend], AttributeValue=[0] Image=[2]; Attribute=[dataFormatAs], AttributeValue=[0] Image=[2]; Attribute=[ontimeupdate], AttributeValue=[0] Image=[2]; Attribute=[oncellchange], AttributeValue=[0] Image=[2]; Attribute=[onloadstart], AttributeValue=[0] Image=[2]; Attribute=[aria-valuemin], AttributeValue=[0] Image=[2]; Attribute=[onlayoutcomplete], AttributeValue=[0] Image=[2]; Attribute=[onhelp], AttributeValue=[0] Image=[2]; Attribute=[onerrorupdate], AttributeValue=[0] Image=[2]; Attribute=[contentEditable], AttributeValue=[0] Image=[2]; Attribute=[ondurationchange], AttributeValue=[0] Image=[2]; Attribute=[onmousedown], AttributeValue=[0] Image=[2]; Attribute=[onwaiting], AttributeValue=[0] Image=[2]; Attribute=[aria-setsize], AttributeValue=[0] Image=[2]; Attribute=[onpaste], AttributeValue=[0] Image=[2]; Attribute=[onmouseleave], AttributeValue=[0] Image=[2]; Attribute=[onselect], AttributeValue=[0] Image=[2]; Attribute=[onclick], AttributeValue=[0] Image=[2]; Attribute=[ondrag], AttributeValue=[0] Image=[2]; Attribute=[aria-controls], AttributeValue=[0] Image=[2]; Attribute=[onresizestart], AttributeValue=[0] Image=[2]; Attribute=[aria-flowto], AttributeValue=[0] Image=[2]; Attribute=[ondatasetcomplete], AttributeValue=[0] Image=[2]; Attribute=[aria-required], AttributeValue=[0] Image=[2]; Attribute=[onended], AttributeValue=[0] Image=[2]; Attribute=[onemptied], AttributeValue=[0] Image=[2]; Attribute=[aria-describedby], AttributeValue=[0] Image=[2]; Attribute=[onmouseenter], AttributeValue=[0] Image=[2]; Attribute=[onbeforecut], AttributeValue=[0] Image=[2]; Attribute=[aria-activedescendant], AttributeValue=[0] Image=[2]; Attribute=[aria-multiselectable], AttributeValue=[0] Image=[2]; Attribute=[onprogress], AttributeValue=[0] Image=[2]; Attribute=[border], AttributeValue=[0] Image=[2]; Attribute=[lowsrc], AttributeValue=[0] Image=[2]; Attribute=[name], AttributeValue=[0] Image=[2]; Attribute=[hspace], AttributeValue=[0] Image=[2]; Attribute=[alt], AttributeValue=[Google] Image=[2]; Attribute=[vspace], AttributeValue=[0] Image=[2]; Attribute=[align], AttributeValue=[0] Image=[2]; Attribute=[loop], AttributeValue=[0] Image=[2]; Attribute=[src], AttributeValue=[/images/srpr/logo3w.png] Image=[2]; Attribute=[isMap], AttributeValue=[0] Image=[2]; Attribute=[width], AttributeValue=[275] Image=[2]; Attribute=[start], AttributeValue=[0] Image=[2]; Attribute=[vrml], AttributeValue=[0] Image=[2]; Attribute=[dynsrc], AttributeValue=[0] Image=[2]; Attribute=[longDesc], AttributeValue=[0] Image=[2]; Attribute=[height], AttributeValue=[95] Image=[2]; Attribute=[useMap], AttributeValue=[0] Image=[3]; Attribute=[onresizeend], AttributeValue=[0] Image=[3]; Attribute=[onrowenter], AttributeValue=[0] Image=[3]; Attribute=[aria-haspopup], AttributeValue=[0] Image=[3]; Attribute=[ondragleave], AttributeValue=[0] Image=[3]; Attribute=[oncut], AttributeValue=[0] Image=[3]; Attribute=[onbeforepaste], AttributeValue=[0] Image=[3]; Attribute=[ondragover], AttributeValue=[0] Image=[3]; Attribute=[onbeforecopy], AttributeValue=[0] Image=[3]; Attribute=[aria-disabled], AttributeValue=[0] Image=[3]; Attribute=[onpage], AttributeValue=[0] Image=[3]; Attribute=[onbeforeactivate], AttributeValue=[0] Image=[3]; Attribute=[accessKey], AttributeValue=[0] Image=[3]; Attribute=[onfocusin], AttributeValue=[0] Image=[3]; Attribute=[onbeforeeditfocus], AttributeValue=[0] Image=[3]; Attribute=[oncontrolselect], AttributeValue=[0] Image=[3]; Attribute=[aria-hidden], AttributeValue=[0] Image=[3]; Attribute=[onloadedmetadata], AttributeValue=[0] Image=[3]; Attribute=[onblur], AttributeValue=[0] Image=[3]; Attribute=[hideFocus], AttributeValue=[0] Image=[3]; Attribute=[style], AttributeValue=[margin-right: 5px; vertical-align: middle;] Image=[3]; Attribute=[oninput], AttributeValue=[0] Image=[3]; Attribute=[onbeforedeactivate], AttributeValue=[0] Image=[3]; Attribute=[dir], AttributeValue=[0] Image=[3]; Attribute=[aria-expanded], AttributeValue=[0] Image=[3]; Attribute=[onkeydown], AttributeValue=[0] Image=[3]; Attribute=[ondragstart], AttributeValue=[0] Image=[3]; Attribute=[onscroll], AttributeValue=[0] Image=[3]; Attribute=[onpropertychange], AttributeValue=[0] Image=[3]; Attribute=[ondragenter], AttributeValue=[0] Image=[3]; Attribute=[id], AttributeValue=[0] Image=[3]; Attribute=[aria-level], AttributeValue=[0] Image=[3]; Attribute=[onrowsinserted], AttributeValue=[0] Image=[3]; Attribute=[onmovestart], AttributeValue=[0] Image=[3]; Attribute=[onabort], AttributeValue=[0] Image=[3]; Attribute=[oncanplay], AttributeValue=[0] Image=[3]; Attribute=[lang], AttributeValue=[0] Image=[3]; Attribute=[onmouseup], AttributeValue=[0] Image=[3]; Attribute=[aria-busy], AttributeValue=[0] Image=[3]; Attribute=[oncontextmenu], AttributeValue=[0] Image=[3]; Attribute=[onsuspend], AttributeValue=[0] Image=[3]; Attribute=[onpause], AttributeValue=[0] Image=[3]; Attribute=[language], AttributeValue=[0] Image=[3]; Attribute=[onratechange], AttributeValue=[0] Image=[3]; Attribute=[onstalled], AttributeValue=[0] Image=[3]; Attribute=[dataSrc], AttributeValue=[0] Image=[3]; Attribute=[implementation], AttributeValue=[0] Image=[3]; Attribute=[onerror], AttributeValue=[0] Image=[3]; Attribute=[onbeforeupdate], AttributeValue=[0] Image=[3]; Attribute=[onreadystatechange], AttributeValue=[0] Image=[3]; Attribute=[onload], AttributeValue=[0] Image=[3]; Attribute=[onresize], AttributeValue=[0] Image=[3]; Attribute=[aria-checked], AttributeValue=[0] Image=[3]; Attribute=[aria-readonly], AttributeValue=[0] Image=[3]; Attribute=[oncopy], AttributeValue=[0] Image=[3]; Attribute=[onchange], AttributeValue=[0] Image=[3]; Attribute=[onselectstart], AttributeValue=[0] Image=[3]; Attribute=[onmove], AttributeValue=[0] Image=[3]; Attribute=[ondragend], AttributeValue=[0] Image=[3]; Attribute=[onrowexit], AttributeValue=[0] Image=[3]; Attribute=[aria-secret], AttributeValue=[0] Image=[3]; Attribute=[onactivate], AttributeValue=[0] Image=[3]; Attribute=[onloadeddata], AttributeValue=[0] Image=[3]; Attribute=[onseeking], AttributeValue=[0] Image=[3]; Attribute=[class], AttributeValue=[0] Image=[3]; Attribute=[onfocus], AttributeValue=[0] Image=[3]; Attribute=[onmouseover], AttributeValue=[0] Image=[3]; Attribute=[onseeked], AttributeValue=[0] Image=[3]; Attribute=[oncanplaythrough], AttributeValue=[0] Image=[3]; Attribute=[onsubmit], AttributeValue=[0] Image=[3]; Attribute=[onmousemove], AttributeValue=[0] Image=[3]; Attribute=[title], AttributeValue=[0] Image=[3]; Attribute=[role], AttributeValue=[0] Image=[3]; Attribute=[dataFld], AttributeValue=[0] Image=[3]; Attribute=[onfocusout], AttributeValue=[0] Image=[3]; Attribute=[onfilterchange], AttributeValue=[0] Image=[3]; Attribute=[disabled], AttributeValue=[0] Image=[3]; Attribute=[onreset], AttributeValue=[0] Image=[3]; Attribute=[aria-posinset], AttributeValue=[0] Image=[3]; Attribute=[ondrop], AttributeValue=[0] Image=[3]; Attribute=[ondblclick], AttributeValue=[0] Image=[3]; Attribute=[onrowsdelete], AttributeValue=[0] Image=[3]; Attribute=[onplay], AttributeValue=[0] Image=[3]; Attribute=[tabIndex], AttributeValue=[0] Image=[3]; Attribute=[onkeypress], AttributeValue=[0] Image=[3]; Attribute=[aria-relevant], AttributeValue=[0] Image=[3]; Attribute=[onlosecapture], AttributeValue=[0] Image=[3]; Attribute=[aria-live], AttributeValue=[0] Image=[3]; Attribute=[ondeactivate], AttributeValue=[0] Image=[3]; Attribute=[aria-labelledby], AttributeValue=[0] Image=[3]; Attribute=[aria-pressed], AttributeValue=[0] Image=[3]; Attribute=[ondatasetchanged], AttributeValue=[0] Image=[3]; Attribute=[ondataavailable], AttributeValue=[0] Image=[3]; Attribute=[aria-invalid], AttributeValue=[0] Image=[3]; Attribute=[onafterupdate], AttributeValue=[0] Image=[3]; Attribute=[onmousewheel], AttributeValue=[0] Image=[3]; Attribute=[onkeyup], AttributeValue=[0] Image=[3]; Attribute=[aria-valuenow], AttributeValue=[0] Image=[3]; Attribute=[aria-selected], AttributeValue=[0] Image=[3]; Attribute=[onmouseout], AttributeValue=[0] Image=[3]; Attribute=[aria-owns], AttributeValue=[0] Image=[3]; Attribute=[onvolumechange], AttributeValue=[0] Image=[3]; Attribute=[aria-valuemax], AttributeValue=[0] Image=[3]; Attribute=[onplaying], AttributeValue=[0] Image=[3]; Attribute=[onmoveend], AttributeValue=[0] Image=[3]; Attribute=[dataFormatAs], AttributeValue=[0] Image=[3]; Attribute=[ontimeupdate], AttributeValue=[0] Image=[3]; Attribute=[oncellchange], AttributeValue=[0] Image=[3]; Attribute=[onloadstart], AttributeValue=[0] Image=[3]; Attribute=[aria-valuemin], AttributeValue=[0] Image=[3]; Attribute=[onlayoutcomplete], AttributeValue=[0] Image=[3]; Attribute=[onhelp], AttributeValue=[0] Image=[3]; Attribute=[onerrorupdate], AttributeValue=[0] Image=[3]; Attribute=[contentEditable], AttributeValue=[0] Image=[3]; Attribute=[ondurationchange], AttributeValue=[0] Image=[3]; Attribute=[onmousedown], AttributeValue=[0] Image=[3]; Attribute=[onwaiting], AttributeValue=[0] Image=[3]; Attribute=[aria-setsize], AttributeValue=[0] Image=[3]; Attribute=[onpaste], AttributeValue=[0] Image=[3]; Attribute=[onmouseleave], AttributeValue=[0] Image=[3]; Attribute=[onselect], AttributeValue=[0] Image=[3]; Attribute=[onclick], AttributeValue=[0] Image=[3]; Attribute=[ondrag], AttributeValue=[0] Image=[3]; Attribute=[aria-controls], AttributeValue=[0] Image=[3]; Attribute=[onresizestart], AttributeValue=[0] Image=[3]; Attribute=[aria-flowto], AttributeValue=[0] Image=[3]; Attribute=[ondatasetcomplete], AttributeValue=[0] Image=[3]; Attribute=[aria-required], AttributeValue=[0] Image=[3]; Attribute=[onended], AttributeValue=[0] Image=[3]; Attribute=[onemptied], AttributeValue=[0] Image=[3]; Attribute=[aria-describedby], AttributeValue=[0] Image=[3]; Attribute=[onmouseenter], AttributeValue=[0] Image=[3]; Attribute=[onbeforecut], AttributeValue=[0] Image=[3]; Attribute=[aria-activedescendant], AttributeValue=[0] Image=[3]; Attribute=[aria-multiselectable], AttributeValue=[0] Image=[3]; Attribute=[onprogress], AttributeValue=[0] Image=[3]; Attribute=[border], AttributeValue=[0] Image=[3]; Attribute=[lowsrc], AttributeValue=[0] Image=[3]; Attribute=[name], AttributeValue=[0] Image=[3]; Attribute=[hspace], AttributeValue=[0] Image=[3]; Attribute=[alt], AttributeValue=[0] Image=[3]; Attribute=[vspace], AttributeValue=[0] Image=[3]; Attribute=[align], AttributeValue=[0] Image=[3]; Attribute=[loop], AttributeValue=[0] Image=[3]; Attribute=[src], AttributeValue=[/images/mgyhp_sm.png] Image=[3]; Attribute=[isMap], AttributeValue=[0] Image=[3]; Attribute=[width], AttributeValue=[14] Image=[3]; Attribute=[start], AttributeValue=[0] Image=[3]; Attribute=[vrml], AttributeValue=[0] Image=[3]; Attribute=[dynsrc], AttributeValue=[0] Image=[3]; Attribute=[longDesc], AttributeValue=[0] Image=[3]; Attribute=[height], AttributeValue=[14] Image=[3]; Attribute=[useMap], AttributeValue=[0] Edited November 29, 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.
Zohar Posted November 29, 2012 Author Posted November 29, 2012 (edited) Thank you jdelaney.. Try the following and you will most likely see that you have captured something other than an image.MsgBox(0,"",$IMG.nodeName) Hi DanP2 I did what you advised, and got: Amazing.. Why is it happenning? and what can I do to make it an IMG only and not a DIV? and Interesting detail would be, that when I do: Local $IMG =$oIE.document.activeElement MsgBox(0,"",$IMG.innerHTML) I get: And when I do: Local $IMG =$oIE.document.activeElement MsgBox(0,"",$IMG.outerHTML) I get: Edited November 29, 2012 by Zohar
DaleHohm Posted November 29, 2012 Posted November 29, 2012 Which is what I suspected in the beginning. Why the heck did you use innerhtml in your previous reply when I suggested you use outerhtml? The active element is a DIV, which happens to contain an IMG. What you do next will depend on what you are really trying to accomplish and the characteristics of the HTML source. If you always get a DIV wrapping the IMG you want, you can use _IETagnameGetCollection($oDIV, "img", 0) 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
Zohar Posted November 29, 2012 Author Posted November 29, 2012 (edited) Which is what I suspected in the beginning. Why the heck did you use innerhtml in your previous reply when I suggested you use outerhtml? It was a big mistake by me, and I am sorry. You're right.. The active element is a DIV, which happens to contain an IMG. Very weird that it's like that. Because what I RightClick, is the Image.. Why IE decides to take an encapsulating DIV, instead of the actual thing that I RightClicked.. Anyhow, I decided to experiment more. You see the AutoIt Image on the top-left of current page? (it's actually on the top-left of every page in the website) I RightClicked it, and pressed ESC, so it got focussed, and then I printed the following: $IMG.nodeName: A $IMG.innerHTML: <IMG alt=Logo src="http://aut1.autoit-cdn.com/forum/public/style_images/master/logo_autoit.png"> $IMG.outerHTML: <A><IMG src="..."></A> (I replaced the content of the SRC here with "..." because it did problems with saving this post..) I then tried a third thing: I created a file called webpage.htm, and put this in it: <HTML> <IMG SRC="the autoit image"> </HTML> (I again had to delete the content of SRC from the post here, because it did problems here in the forum) I opened IE, opened that webpage, RightClicked the Image, and then pressed ESC, and then ran my 3 prints. The results are: $IMG.nodeName: BODY $IMG.innerHTML: <IMG src="..."> $IMG.outerHTML: <BODY><IMG src="..."> </BODY> IE now encapsulated it with a BODY tag, even there's no explicit BODY tag in the webpage's source. What we can learn from it, is that Eventho we click the Image, IE will not return the IMG object that we clicked, but the object that contains that IMG inside it. It always gives 1 level up. Now I am curious to ask.. Does IE's DOM enable us, to navigate programatically from a containing object to a contained object? Some way to "drill down"? Edited November 29, 2012 by Zohar
DaleHohm Posted November 29, 2012 Posted November 29, 2012 I showed you how in my last reply. 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
Zohar Posted December 3, 2012 Author Posted December 3, 2012 (edited) Hi Dale I did it now: Local $PO_Containing =$oIE.document.activeElement MsgBox(0,"",$PO_Containing.nodeName) ;Prints "DIV" Local $PO_IMG =$PO_Containing.GetElementsByTagName("IMG").item(0) MsgBox(0,"",$PO_IMG.nodeName) ;Prints "IMG" MsgBox(0,"",$PO_IMG.src) ;Prints what I wanted :) It works perfect! Thank you very much Edited December 3, 2012 by Zohar
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