I never needed to solve this problem but if I may nudge you towards this:
1. get the base div.html
2. and pump it to Hpricot for processing
and maybe use 'children_of_type "div" call to get to divs you need.
a wild suggestion since purely theoretical.

marekj

Watirloo: Semantic Page Objects in UseCases
http://github.com/marekj/watirloo/




On Tue, Apr 14, 2009 at 1:02 PM,  <[email protected]> wrote:
>
> How can xpath be used to return an array of divs? What would the xpath
> look like?
>
> On Apr 14, 10:30 am, Michael Hwee <[email protected]> wrote:
>> Can you try xpath?
>>
>>
>>
>> ----- Original Message ----
>> From: "[email protected]" <[email protected]>
>> To: Watir General <[email protected]>
>> Sent: Tuesday, April 14, 2009 7:54:53 AM
>> Subject: [wtr-general] First level children only
>>
>> I have a large tree of nested divs, and I want to get an array of just
>> the direct children of any particular div. I do not know ahead of time
>> how many divs there will be at any level. Starting from a div, what is
>> the Watir code for getting the divs that are direct children (and yes,
>> there are other element types mixed in throughout)?
>>
>> Example
>>
>> <div id=1>
>>   <div/>
>>   <div>
>>      <div/>
>>      <div/>
>>    </div>
>>    <div/>
>> </div>
>>
>> divs() returns the entire list of all descendant div elements. I want
>> just the first level children.
>>
>> Andy- Hide quoted text -
>>
>> - Show quoted text -
> >
>

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

Reply via email to