Thanks, Raveendran -- that did it...

On Tue, Jun 28, 2011 at 1:50 AM, Raveendran P <[email protected]> wrote:

> 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 -- @[email protected]
> 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 <[email protected]> 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.
>>
>> [email protected]
>> http://groups.google.com/group/watir-general
>> [email protected]<http://groups.google.com/group/watir-general%[email protected]>
>>
>
>
>
> --
> Regards,
> P.Raveendran
> http://raveendran.wordpress.com
>
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]
>

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

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to