<br><br><div><span class="gmail_quote">On 5/2/07, <b class="gmail_sendername">Jason &amp; Aneta</b> &lt;<a href="mailto:freezingkiwis@gmail.com">freezingkiwis@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hey all,<br><br>Using the 1.5.1.1158 gem and enjoying the class support.<br><br>Within my web page, I have the following, with 3 &lt;div&gt; nested inside<br>the main &quot;content&quot; &lt;div&gt;.<br><br>&lt;div class=&quot;content&quot;&gt;
<br>&nbsp;&nbsp; &lt;div class=&quot;contentItem&quot;&gt;<br>&nbsp;&nbsp; &lt;/div&gt;<br>&nbsp;&nbsp; &lt;div class=&quot;contentItem&quot;&gt;<br>&nbsp;&nbsp; &lt;/div&gt;<br>&nbsp;&nbsp; &lt;div class=&quot;contentItem&quot;&gt;<br>&nbsp;&nbsp; &lt;/div&gt;<br>&lt;/div&gt;<br>
<br>How do I retrieve / act within the nth instance, i.e. the 1st, 2nd or<br>3rd of these &quot;contentItem&quot; divs?</blockquote><div><br>Hi Jason, <br></div><br>divs (and many other elements) can be accessed by :index. For example: 
<br><div><pre>ie.div(:index,2)                    # access the second div on the page<br><br></pre></div>You can also identify elements using multiple attributes, for example :class and :index :<br><br>ie.div(:class =&gt; &#39;contentItem&#39;, :index =&gt; 3)&nbsp; # access the 3rd div with a class of &#39;contentItem&#39; 
<br><br>...I believe that you can also as a variation go for the Nth div within a div like so:<br><br>ie.div(:class, &#39;content&#39;).div(:index, 4)&nbsp; # access the div with class=&#39;content&#39;, and then access the 4th div within it.
<br><br>Take this last one with a grain of salt - I don&#39;t have a page to test it on right now, but I believe that it works as I describe here.<br><br>Hope that helps,<br>Jeff<br></div><br clear="all"><br>-- <br><a href="http://testingjeff.wordpress.com">
http://testingjeff.wordpress.com</a>