petronio Posted August 25, 2014 Share Posted August 25, 2014 Hi there I'm trying to automate a website at my work. This website has a data table and 10 rows per page. Press a "Next" link table data changes with other data and the same URL. Func Pru1() $oGrd = _IETableGetCollection ($oIE, 9) $aTableData = _IETableWriteToArray($oGrd) _ArrayDisplay($aTableData) EndFunc When I run the func Pru1 get the data shown in the table. However, when I use Pru2 making a click on the "Next" link I see other data in the table and I get an error: C: Program Files (x86) AutoIt3 Include IE.au3 (1918): ==> Array Variable subscript badly formatted .: Local $ a_TableCells [$ i_cols] [$ i_rows] Local $ a_TableCells [$ i_cols] [ERROR ^ Func Pru2() _IELinkClickByText($oIE,"Next") $oGrd = _IETableGetCollection ($oIE, 9) $aTableData = _IETableWriteToArray($oGrd) _ArrayDisplay($aTableData) EndFunc If the browser used the "View Source Code" can only see the data from the first 10 rows. How I read this data seems to be loaded dynamically ?. Sorry for my bad english. thx Link to comment Share on other sites More sharing options...
Jury Posted August 25, 2014 Share Posted August 25, 2014 I think you need to navigate to the next page (if I understand correctly) and then _IETableGetCollection again: _IENavigate Link to comment Share on other sites More sharing options...
petronio Posted August 26, 2014 Author Share Posted August 26, 2014 Thank you for your reply When I press the "Next" link not navigate to another page I remain the same. I'll try to explain it a little better with an example. I navigate to the URL “http192.168.210.1GestionUsers” where a table with data is loaded. Name Email 1 Name1 Name1@email.com 2 Name2 Name2@email.com 3 Name3 Name3@email.com 4 Name4 Name4@email.com 5 Name5 Name5@email.com 6 Name6 Name6@email.com 7 Name7 Name7@email.com 8 Name8 Name8@email.com 9 Name9 Name9@email.com 10 Name10 Name10@email.com Next> If in the browser click the "View Source Code" I can see something like: <table class="listing" cellspacing="0" rules="all" border="0" id="ctl00_ContentPlaceCuerpoPagina_tblDatos" style="border-width:0px;border-collapse:collapse;"> <tr> <th class="first" scope="col">Name</th><th scope="col">Email</th> </tr> <tr class="row"> <td>Name1</td><td> Name1@email.com </td> </tr> <tr class="row"> <td>Name2</td><td> Name2@email.com </td> </tr> … <tr class="row"> <td>Name10</td><td> Name10@email.com </td> </tr> </table> When I press the "Next" link not navigate to another page I remain the same “http192.168.210.1GestionUsers” but I can see the data have changed. Name Email 11 Name11 Name11@email.com 12 Name12 Name12@email.com 13 Name13 Name13@email.com 14 Name14 Name14@email.com 15 Name15 Name15@email.com 16 Name16 Name16@email.com 17 Name17 Name17@email.com 18 Name18 Name18@email.com 19 Name19 Name19@email.com 20 Name20 Name20@email.com <Previous Next> If I click the option in the browser "View Source Code" I can see the same code before clicking the "Next" link, however, see other data in the table: Name11, Name12 ... <table class="listing" cellspacing="0" rules="all" border="0" id="ctl00_ContentPlaceCuerpoPagina_tblDatos" style="border-width:0px;border-collapse:collapse;"> <tr> <th class="first" scope="col">Name</th><th scope="col">Email</th> </tr> <tr class="row"> <td>Name1</td><td> Name1@email.com </td> </tr> <tr class="row"> <td>Name2</td><td> Name2@email.com </td> </tr> … <tr class="row"> <td>Name10</td><td> Name10@email.com </td> </tr> </table> How I read this data seems to be loaded dynamically ?. Thank in advance Link to comment Share on other sites More sharing options...
Danp2 Posted August 26, 2014 Share Posted August 26, 2014 What version of Autoit are you running? You haven't shown us what code gets executed when you click the Next link. I would suggest adding some error checking to your code as it's likely that the new data hasn't fully loaded when you attempt to grab the table contents. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Solution DaleHohm Posted August 27, 2014 Solution Share Posted August 27, 2014 You may not be allowing enough time for the table to repopulate after clicking next before you try to read it again. Try putting in a Sleep(xxx) to see if it solves your problem. If it does, then use a more sophisticated delay (you may be able to use _IELoadWait on the table or you may have to check it's content more directly). Dlae petronio 1 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...
petronio Posted August 27, 2014 Author Share Posted August 27, 2014 Thank you all for your replies. As DaleHohm says I have put a Sleep(5000) and works correctly. It was a problem of delay in the refresh of the page. 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