Here's the code: # Please, when you update this file, update also http://wiki.openqa.org/display/WTR/Example+Test+Case
#-------------------------------------------------------------# # Demo test for the Watir controller. # # Purpose: to demonstrate the following Watir functionality: # * entering text into a text field, # * clicking a button, # * checking to see if a page contains text. # Test will search Google for the "pickaxe" Ruby book. #-------------------------------------------------------------# # the Watir controller require "watir" # set a variable test_site = "http://www.google.com" # open a browser browser = Watir::Browser.new # print some comments puts "Beginning of test: Google search." puts " Step 1: go to the test site: " + test_site browser.goto test_site puts " Step 2: enter 'pickaxe' in the search text field." browser.text_field(:name, "q").set "pickaxe" # "q" is the name of the search field puts " Step 3: click the 'Google Search' button." browser.button(:name, "btnG").click # "btnG" is the name of the Search button puts " Expected Result:" puts " A Google page with results should be shown. 'Programming Ruby' should be high on the list." puts " Actual Result:" if browser.text.include? "Programming Ruby" puts " Test Passed. Found the test string: 'Programming Ruby'. Actual Results match Expected Results." else puts " Test Failed! Could not find: 'Programming Ruby'." end puts "End of test: Google search." On Sep 23, 8:38 am, Angrez Singh <[email protected]> wrote: > Can you post the code over here? > > On Tue, Sep 22, 2009 at 11:45 PM, Neil <[email protected]> wrote: > > > I'm new to both Ruby and Watir, and I'm having a problem running the > > google search example: > > > C:\Ruby\lib\ruby\gems\1.8\gems\watir-1.6.2\lib/watir/container.rb: > > 275:in `text_field': uninitialized constant > > Watir::Container::TextField (NameError) > > > What's weird is that it does open the browser and correctly points it > > tohttp://www.google.com, but bombs out when it tries to set the > > search field. > > > I'm sufficiently new to Ruby to not have a clue what uninitialized > > constant means (I'm assuming it can't find the > > Watir::Container::TextField class, but I did a grep on my ruby/gems.../ > > lib, and I do have watir/input_elements.rb in my path). > > > I would appreciate any help on how to fix this problem. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
