some one else asked a similar question a while back. I pointed them to
some kind of solution, but I really cant remember what it was. It may
have been something like taking the html, and using scan to get the
div tags, and then using index to find the ones you are after.

Paul

On Wed, Feb 4, 2009 at 9:34 PM, Jason <freezingki...@gmail.com> wrote:
>
> I've got anywhere from 1 to 10 <div> elements on my page with the same
> class.
>
> <div class="details">
>
> I want a robust and quick way of determining how many, or iterating
> through each of these divs.
>
> divs.find_all does the job, but it's rather slow because it appears to
> be iterating through EVERY <div> on my page (300+) and then attempting
> to match these to the class, i.e.
>
>   $ie.divs.find_all{|dv|/details/.match(dv.class_name)}.length
>
> A little bit slow.
>
> Alternatively I thought of using :index until I resulted in an error,
> i.e.
>
>   for i in 1..10 (until an error occurs)
>      $ie.div(:class=>"details", :index=>i)
>   end
>
> But this seems a little messy.
>
> Any better suggestions? Something simple I'm missing?
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
watir-general-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to