Rewrite the first section: require 'watir' include Watir Watir::Browser.default = 'ie' $ie = Browser.new
as require 'watir' Watir.Browser.default = 'ie' # Not really needed on Windows as 'ie' is always the default anyway... $ie = Watir::Browser.new works fine for me that way - though I do get a number of issues if I use "include Watir" and set up my browser object as Browser.new like you originally did... Regards, John On Feb 11, 8:58 am, Martin <ninty...@163.com> wrote: > C:\>gem update --system > Updating RubyGems > Nothing to update > > C:\>gem install watir > Successfully installed watir-1.6.2 > 1 gem installed > Installing ri documentation for watir-1.6.2... > Installing RDoc documentation for watir-1.6.2... > > My script: > require 'watir' > include Watir > Watir::Browser.default = 'ie' > $ie = Browser.new > #Open yahoo mail. > $ie.goto("http://mail.yahoo.com") > > #Put your user name. > $ie.text_field(:name,"login").set("User_Name") > $ie.text_field(:name, "login").set("User_Name") > #Put your password. > $ie.text_field(:name,"passwd").set("Password") > > #Click Sign In button. > $ie.button(:value,"Sign In").click > > #Click Sign Out button. > $ie.link(:text, "Sign Out").click > > #Close the browser. > $ie.close > > When I run it, I got uninitialized constant > Watir::Container::TextField (NameError). > > Does anyone know what's wrong with my script? > > Error Message: > c:/rails2.1/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ > active_support/dependencies.rb:442:in `load_missing_constant': > uninitialized constant Watir::Container::TextField (NameError) > from c:/rails2.1/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/ > active_support/dependencies.rb:77:in `const_missing' > from c:/rails2.1/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ > container.rb:275:in `text_field' --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---