[wtr-general] Re: First level children only

2009-04-19 Thread Mark O'Shea
One other way is to use the element method 'attribute_value' so assuming your first level child divs have some attribute, div id=1 div xyz='abc'/ div xyz='def' div/ div/ /div div/ /div this code will work ie.div(:id, 1).divs do |child| if child.attribute_value('xyz') =~

[wtr-general] Re: First level children only

2009-04-17 Thread ad
I faced the same problem too. I had to create a function to solve this problem Basically recurse creates a hash of all the divs from the root div. I had something similar to: div div div div div div div div div div div

[wtr-general] Re: First level children only

2009-04-17 Thread marekj
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

[wtr-general] Re: First level children only

2009-04-17 Thread Paul Rogers
this might be simpler: top_div = ie.div(:id , 'toplevel') top_div.divs.each do | a_child | next unless a_child.document.parentElement.invoke( id) == top_div.id puts an immediate child is + a_child.id end untested, but it seems sound, as long as you have useful identifiers of some

[wtr-general] Re: First level children only

2009-04-14 Thread Michael Hwee
Can you try xpath? - Original Message From: andrew.d...@lthree.com andrew.d...@lthree.com To: Watir General watir-general@googlegroups.com 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

[wtr-general] Re: First level children only

2009-04-14 Thread andrew . dahl
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 michael_h...@yahoo.com wrote: Can you try xpath? - Original Message From: andrew.d...@lthree.com andrew.d...@lthree.com To: Watir General