Hi!

You don't need this line:
 s = Watir::Simple

Your assert should read:
ie.assert_text_in_body("Please enter your Username",nil)

(the second parameter, 'nil' is optional, so you could leave it out).

I just did some searching and found that you need to include
Watir::Simple, but the discussions I found on that date back to
2005-2006.  I gave it a shot in an irb session and found that the
watir_simple methods were only available after I did the include, but
then I got a different error when I tried to use it:

NameError: uninitialized class variable @@browser in Watir::Simple
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/
watir_simple.r
b:276:in `assert_text_in_body'
        from (irb):12

Is anyone else using watir_simple?  I didn't even know it existed
(guess I should have looked around more!).  Is it still supported?

In the mean time, you can do a simple check to see if the text exists
like this:

ie.text.include?('Please enter your Username')

If you need to perform assertions, you might want look into using
RSpec or Test::Unit.

Hope this helps!

-Tiffany

On Oct 21, 10:02 am, abhisheksreepal <[email protected]>
wrote:
> Hi,
>
> I have just started learning Watir.
> Please let me know what is wrong
>
> require 'test/unit'
> require "watir"
> require 'watir/testcase'
> require 'watir/watir_simple'
>
> class Login < Watir::TestCase
>     def test_login
>       ie=Watir::Browser.new
>      s = Watir::Simple
>       ie.goto("google.com")
>       ie.link(:href,"some_link1").click
>       ie.link(:href,"some_link2").click
>       s.assert_text_in_body("Please enter your Username",nil)
> end
>   end
>
> OUTPUT:
>
>  1) Error:
> test_login(Login):
> NoMethodError: undefined method `assert_text_in_body' for
> Watir::Simple:Module
>     test.rb:14:in `test_login'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to [email protected]
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to