Jump to content

Refresh the DOM Reference after Jquery changed the DOM


 Share

Recommended Posts

Hello,

I've created a reference to the IE9 and its DOM Object with the following line of Code:

$oIE = _IECreate($oSiteLogonAddress)

With that Object I work now very successful with Test-Cases.

Now to my Problem:

On one Page there is a jQuery "DataGrid" after executing a search the Grid (TableBody) will be filled by the Result Data like this:

<table>
    <thead>
        <tr>
            <th>
                ...
            </th>
            <th>
                ...
            </th>
        </tr>
    </thead>
</table>
<table>
    <tbody id="Tb1" unselectable="on">
        <tr id="0" role="row">
            <td title="50410" role="gridcell" aria-describedby="gridCustomer_postcodeprimary">
                50410
            </td>
            <td title="Brasil" role="gridcell" aria-describedby="gridCustomer_country">
                Brasil
            </td>
            <td>
                ....
            </td>
        </tr>
    </tbody>
</table>

But if I run that code:

$oTBODY = $oIE.document.getElementById("Tb1")
$oTR = $oTBODY.getElementById("0")

I get a exception at the second line. After some research I've found out, that the $oIE object has not the changes that the jquery has made with by filled the results in the Grid.

That means the TableRow <tr id="0" role="row" .... /> ist not existing in the $oIE reference.

How can I release a refresh or more reallocation of the $oIE Object with the current DOM of the External IE instance?

(Please note that I NOT mean a refresh of the Page like <F5> <-- only answers to that I've found by google to my current problem )

Link to comment
Share on other sites

Hallo Spammer!

Thank you for your answer. Its difficult for me to post a reproducer because the intranet page not public.

I'm sure I had seen a solution for that problem but after long time of search I still didn't found it.

And at my other topic ( ) there I really understand that I have to send a reproducer.

But here in that case not really. I only like to know:

"With witch AutoIt command become my $oIE reference Object in Sync with the current DOM?"

I think for that Question is no reproducer necessary.

May I think Dale Hohm know a answer to that question!? :)

Nevertheless thank you for your reply!

EDIT:

I've found a other topic with a look like same problem:

Edited by mima1974
Link to comment
Share on other sites

I do not know however, you have access to Javascript which has access to the DOM which (I believe) should be current, it might therefor well be something else is at falt and a reproducer might bring such things to light.

I hope you figure it out, good luck.

Link to comment
Share on other sites

You are most likely having a timing issue - the DOM does not need to be refreshed, but you need to realize that objects are routinely created, destroyed and perhaps recreated, so object references (and those of their children) you have obtained in your script may no longer be valid and need to be obtained again. Most likely, you are trying to get a reference to an object before it is fully instatiated in the DOM... if this is the case, you need to test for its existance and loop until it becomes available before moving on. The _IE* functions will make this easier for you because of the simple management of return values and error handling.

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

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...