Hello Folks,

I am trying to find syntax for express the following. 

I want to iterate across LI elements in a UL (unordered list)

I thought something like this would do it: 

  all_li_elements = browser.div(:id => 'topLevelMenu0').li

Maybe that's close?

Then I was hoping to iterate though them search for one:

  all_li_elements.each { |e| puts e.text } 

Or perhaps I would use the list of LI elements in an RSpec expect statement 
with an include matcher that specifies one in the list. 

I have used the following to see the text in an LI element:

menu_li_element = browser.div(:id => 'topLevelMenu0').li(:text => "Open New 
Document")

which returns a single LI element. And, I find the text itself here: 

puts menu_li_element.text
"Open New Document"

If you know of some useful references to this kind of stuff on the Net, 
then please share the link or even a few keywords that might help me find 
it. Perhaps there are methods better suited?

-az




-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to