Exit 149 Posted May 1, 2019 Trying to get text of an iframe fails. #include <IE.au3> #include <MsgBoxConstants.au3> #include <String.au3> #include <array.au3> $oIE = _IECreate("https://www.germering-hausaerzte.de/", 1) ConsoleWrite("Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " Isobj: " & IsObj($oIE) & @LF) Local $oFrames = _IEFrameGetCollection($oIE) Local $iNumFrames = @extended ConsoleWrite("Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " Isobj: " & IsObj($oFrames) & @LF) ConsoleWrite($iNumFrames & " frames found" & @CRLF) Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF Local $oFrame = 0 For $i = 0 To ($iNumFrames - 1) $oFrame = _IEFrameGetCollection($oIE, $i) ConsoleWrite("Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " Isobj: " & IsObj($oFrame) & @LF) $sTempTxt = _IEPropertyGet($oFrame, "innertext") ConsoleWrite("Error: " & @error & " Extended: " & @extended & " Line: " & @ScriptLineNumber & " $sTempTxt: " & $sTempTxt & @LF) $sTxt &= $sTempTxt & @CRLF Next MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt) Consoloutput: Quote >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Hubertus\Documents\Data\Autoit\try7.au3" /UserParams +>19:30:41 Starting AutoIt3Wrapper v.16.306.1237.0 SciTE v.3.6.2.0 Keyboard:00000407 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0407) CodePage:0 utf8.auto.check:4 # detect ascii high characters and if none found set default encoding to UTF8 and do not add BOM +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Hubertus\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Hubertus\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\Hubertus\Documents\Data\Autoit\try7.au3 +>19:30:41 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\Hubertus\Documents\Data\Autoit\try7.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop Error: 0 Extended: 1 Line: 10 Isobj: 1 Error: 0 Extended: 3 Line: 14 Isobj: 1 3 frames found Error: 0 Extended: 3 Line: 20 Isobj: 1 "C:\Program Files (x86)\AutoIt3\Include\IE.au3" (2295) : ==> The requested action with this object has failed.: $oTemp = $oObject.document.body $oTemp = $oObject^ ERROR ->19:30:42 AutoIt3.exe ended.rc:1 +>19:30:42 AutoIt3Wrapper Finished. >Exit code: 1 Time: 0.9833 As you see, the _IEPropertyGet() fails. Is there another method to get the text or html. My target is to get the visitor counter in the bottom rigth cormer of the browser window. TIA Exit App: Au3toCmd UDF: _SingleScript() Share this post Link to post Share on other sites
Nine 933 Posted May 1, 2019 @Exit I got it working with this code : #include <Constants.au3> #include <IE.au3> #include <MsgBoxConstants.au3> Opt ("MustDeclareVars", 1) Local $oIE = _IECreate("https://www.germering-hausaerzte.de/") If @error Then Exit MsgBox ($MB_SYSTEMMODAL,"","Error accessing site") Local $oFrame = _IEGetObjById ($oIE, "i79leiwliframe") MsgBox ($MB_SYSTEMMODAL,"",ObjName ($oFrame)) _IENavigate ($oIE, $oFrame.getAttribute ("src")) Sleep (1500) Local $colSpans = _IETagNameGetCollection ($oIE,"span") Local $sVisitor = "" For $oSpan in $colSpans $sVisitor &= $oSpan.innerText Next MsgBox ($MB_SYSTEMMODAL,"",$sVisitor) 1 Exit reacted to this Not much of a signature, but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites
Exit 149 Posted May 1, 2019 @Nine Thanks. Works like a charm ! But honestly, I would never have done that. Now I have a new challenge: I'll try to solve it with the Chrome browser. I hope UIASpy will help me. Will report again if I have a result. If someone else wants to try it too, just do it. App: Au3toCmd UDF: _SingleScript() Share this post Link to post Share on other sites
Nine 933 Posted May 2, 2019 (edited) 3 hours ago, Exit said: Thanks. Works like a charm ! To be honest, it wasn't obvious at first trial...I must also give credit to danp2 who showed me the way. Edited May 2, 2019 by Nine 2 Danp2 and Exit reacted to this Not much of a signature, but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Fast and simple WCD IPC GIF Animation (cached) Share this post Link to post Share on other sites