How do I define the dom after an event

Class library usage, coding and language questions.
aidan.mcdonnel
Posts: 8
Joined: Wed Aug 09, 2017 2:11 pm

How do I define the dom after an event

Post by aidan.mcdonnel » Wed Mar 28, 2018 12:21 pm

I'm testing a dynamic web application at the moment.
Some events change the DOM after the event is fired e.g button is clicked

These events can be AJAX or React

An example would be as follows

Pre event the dom is

Code: Select all

<div id="container ">
    <div> item 1 </div> 
</div>
Post event the dom is

Code: Select all

<div id="container ">
   <div> item 1 </div>
   <div> item 2 </div>
  <div> item 3 </div>
</div>
note the items 2 and 3 are not in the DOM until the event is finished

Do I have to redefine the DOM in some way ??

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How do I define the dom after an event

Post by Support Team » Thu Mar 29, 2018 9:35 pm

Hello Aiden,

Ranorex will perform an action as soon as an element exist and doesn't necessarily care if the DOM has finished loading its dynamic content. The time it waits for an element is specified in the repository object's properties (search timeout).
st.png
st.png (7.11 KiB) Viewed 241 times
If you need it to wait for the page to fully load before performing an action on another object, add an Waitfor > Exist action targeting the last item you expect to load (such as "<div> item 3 </div>").
wf.png
wf.png (7.6 KiB) Viewed 241 times
I hope this answers your question and if not, please further elaborate on what you are trying to achieve and I will be happy to further assist you.

Kind Regards,
Ned
.
Image