Jump to content

IE data table dynamic


Go to solution Solved by DaleHohm,

Recommended Posts

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

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

  • Solution

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 

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...