I’ve been crawling through xpath for the last couple of weeks, but I’ve been unable to solve a real basic problem I am having locating desired objects.  

 

As a background, the application I am automating makes extensive use of AJAX, _javascript_, Dojo and DWR, so the DOM gets complex.

 

Sample XML:

 

<DIV class=A>

   <DIV class=B>

   </DIV>

   <DIV class=B>

   </DIV>

<DIV>

<DIV class=A>
   <DIV class=B>

   </DIV>

   <DIV class=B>

   </DIV>

 </DIV>

 

Now, what I am trying to do is directly access each ‘B’ Div – i.e. :

 

The first B in the first A

The second B in the first A

The first B in the second A

The second B in the second A

ad infinitum…

 

The XML isn’t as simple as the above – since it’s dynamically updated via AJAX- based on context, there are potentially an unknown amount of elements before, after or inside the above tags.  So, stuff like:

 

/DIV[1]/DIV[1]

 

won’t work for me.   Also, while the below looks like it should work (and does on basic XML), it returns a set of *all* B elements under an A from the IE DOM:

 

//[EMAIL PROTECTED]’A’][1]/[EMAIL PROTECTED]’B’][1]

 

Any tips on cracking this nut?

 

 

_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to