myArray = b.divs(:class=>"_again") myArray.each do | theDiv | puts div.text.to_s end
On Friday, March 13, 2015 at 8:07:50 AM UTC-5, Dan wrote: > > Posting the error you get would help. You don't need the "for i" or the > each. Just the below should do it: > > b.divs(:class => "_again").each { |div| puts div.text } > On Thursday, March 12, 2015 at 5:30:27 AM UTC-4, Vish wrote: >> >> Hey guys, >> >> I'm trying to get all divs in a page with class = "_again" and print the >> text that follows. How do I do this? >> >> For eg., I got some help on the #watir IRC suggesting I do the following: >> >> for i in browser.divs(class: "_again").each do { |div| puts div.text } >> >> But I'm getting numerous syntax errors! >> >> Can I get some help on this? >> >> Thanks, >> Vish >> > -- -- 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.