Exit Posted May 1, 2019 Share 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() Link to comment Share on other sites More sharing options...
Nine Posted May 1, 2019 Share 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) Exit 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Exit Posted May 1, 2019 Author Share 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() Link to comment Share on other sites More sharing options...
Nine Posted May 2, 2019 Share 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 Danp2 and Exit 2 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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