I forgot to give an update. Here it is.

Tiffany's method worked great.

e.g.)  ie.div(:class => 'something', :index => 1)

I just made the index value a variable and incremented it for every
loop iteration.

On Apr 6, 10:11 am, IDIEININIIS <ideler.den...@gmail.com> wrote:
> @George,
>
> Yes they are all divs.
>
> @Tiffany,
>
> Hi Tiffany,
> I am trying to get a list of all the objects that are similar.
>
> I'm dealing with nested divs in my case.
>
> E.g.) I'm after all div class="b" (I didn't expand div class a, b and
> c in this case. But they contain info.)
>
> <div id="list" class="results">
>   <liclass="x">
>     <div class="a">
>     <div class="b">
>     <div class="c">
>   </li>
>   <liclass="y">
>     <div class="a">
>     <div class="b">
>     <div class="c">
>   </li>
>   <liclass="z">
>     <div class="a">
>     <div class="b">
>     <div class="c">
>   </li>
> </div>
>
> I'll try both methods that you mentioned and will write back if I had
> any success.
> Thanks.
>
> On Apr 3, 7:51 pm, Tiffany Fodor <tcfo...@comcast.net> wrote:
>
> > Hi Dennis!
>
> > Are you trying to get a list of all of the objects that are similar,
> > or are you trying to perform an action on a specific object that
> > doesn't happen to be the first one?
>
> > You can specify multiple attributes for an object like this:
>
> > ie.div(:class => 'something', :index => 1)
>
> > If you really want a list of all the div objects on your page you can
> > do this:
>
> > ie.show_divs
>
> > Hope this helps!
>
> > -Tiffany
>
> > On Apr 3, 1:18 pm, "Dennis I." <ideler.den...@gmail.com> wrote:
>
> > > Watir returns the first element found when there are multiple elements
> > > with the same name. I'd like for it to return all the elements instead
> > > of just the first one found.
>
> > > I know I can do this by using xpath plus an iterator, but is there any
> > > other quicker way?
>
> > > e.g.)  ie.div(:class, "something")
>
> > > would return the first element with the "something" class attribute.
>
> > > I'd like for it to return ALL "something" classes in that division.
--~--~---------~--~----~------------~-------~--~----~
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