Unicornasaurus Posted September 6, 2012 Share Posted September 6, 2012 Hey guys, I've been scouring the internet looking for an answer to the problem I'm running in to. I have a web page that has a table element with a dynamic number of rows (sometimes it's 10, sometimes it's 80). I'm trying to get my script to grab the entire table, but it only seems to grab 2-3 rows out of the entire 80. This is the code that is grabbing the table: Global $tableColl = _IETableGetCollection($browser,18) Global $tablePage = _IETableWriteToArray($tableColl,True) _ArrayDisplay($tablePage) I've verified that it is the 18th instance of the <table> on the page. When I do the _ArrayDisplay, it will give me 2 random records inside the table. The data in the 2 rows it returns is perfect, but it will randomly choose say, Row 39 and row 42 and not give me anything else back. I did a _IEBodyReadHTML and checked to see if maybe the rest of the HTML was hidden or not loading at the right time, but all of the information is there in the source. I also checked the source of the page to see if maybe there was some unclosed tag or something like that, but I couldn't find anything. I wish I could post the source of the page I'm getting the table information from, but it's an internal website for the company I work for. Anyone have any ideas? I have no idea why it's doing it.. Link to comment Share on other sites More sharing options...
DaleHohm Posted September 6, 2012 Share Posted September 6, 2012 I can think of nothing that can cause that. The function is pretty straight forward. I'd suggest you $sTable = _IEPropertyGet($tablecoll, "outerhtml") and examine what you get back to insure it is the full table as you expect. 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 Link to comment Share on other sites More sharing options...
Unicornasaurus Posted September 6, 2012 Author Share Posted September 6, 2012 I can think of nothing that can cause that. The function is pretty straight forward.I'd suggest you$sTable = _IEPropertyGet($tablecoll, "outerhtml")and examine what you get back to insure it is the full table as you expect.DaleHey Dale,Thanks for the response. I inserted the code you provided and gave it another go. Your suspicions were correct in that it's not giving me back the full table HTML. Just those 2-3 records. I'm confused as to how it's only selecting those records as it seems to always be the same 2-3. Link to comment Share on other sites More sharing options...
jdelaney Posted September 6, 2012 Share Posted September 6, 2012 loop through all your tables, maybe one will return all the data you need: $oIE = _IEAttach ( $browser ) $oTableCol = _IETableGetCollection ($oIE) For $oTable in $oTableCol $aTable = _IETableWriteToArray ( $oTable, True ) _ArrayDisplay ( $aTable ) Next 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. Link to comment Share on other sites More sharing options...
Unicornasaurus Posted September 6, 2012 Author Share Posted September 6, 2012 loop through all your tables, maybe one will return all the data you need: $oIE = _IEAttach ( $browser ) $oTableCol = _IETableGetCollection ($oIE) For $oTable in $oTableCol $aTable = _IETableWriteToArray ( $oTable, True ) _ArrayDisplay ( $aTable ) Next I tried that, but it kept telling me Table 18 was the right one. It seems as though the table is getting populated after the page loads or something similar. When I used the _IEPropertyGet($tableColl,"outerhtml"), it told me that the </table> tag was occuring after 3 rows. I went and checked the source code of the loaded page and found the </table> tag nowhere near where the _IEPropertyGet told me it was. Link to comment Share on other sites More sharing options...
DaleHohm Posted September 7, 2012 Share Posted September 7, 2012 IE.au3 operates on the final loaded page, not the original source. Suggest you try DebugBar. 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 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