Hi Anne, I have no idea how Watir can do this...
But i can give the ruby solution to you Solution: 1. Collect the entire HTML of the page -- @text=@ie.html 2. Search the text "<h2>" in that sting -- @text.scan("<h2>").length Example a="Raveendran -- <h2>Test1</h2><h2>test2</h2>" COUNT= a.scan("<h2>").length Thanks Raveendran P On Mon, Jun 27, 2011 at 11:03 PM, Anne <annemordk...@gmail.com> wrote: > I need to be able to get a count of the number of h2 headers on a > page. > I can determine if a specific header exists by doing > @browser.h2(:text, "Abc").exists? > > but everything I've tried to get a count of the number of headers > gives me the following error -- > "wrong number of arguments <0 for 1>" > > I've tried > @browser.h2.find_all > @browser.h2.count > @browser.h2.length > @browser.h2.all.size > > I even tried @browser.html.scan(:html, "h2").size but it returned 0 > and I know there are at least 5 h2 headers on the page... > > html for a typical h2 header looks like this -- > <h2>Customer Service</h2> > > -- > 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<http://groups.google.com/group/watir-general%0awatir-general+unsubscr...@googlegroups.com> > -- Regards, P.Raveendran http://raveendran.wordpress.com -- 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