# 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 the IE browser
ie = Watir::IE.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 Mar 19, 1:05 pm, George <george.sand...@gmail.com> wrote:
> What does your code look like?
>
> On Mar 19, 9:17 am, slr3975 <slr3...@gmail.com> wrote:
>
> > I am a first time user for Ruby/Watir and after running the google
> > search script to see it work, I get the following info:
>
> > >ruby test.rb
>
> > C:/Ruby/lib/ruby/gems/1.8/gems/windows-pr-0.9.3/lib/windows/thread.rb:
> > 59: uninitialized constant Windows::API::Error (NameError)
> >         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> >         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> >         from C:/Ruby/lib/ruby/gems/1.8/gems/win32-process-0.5.9/lib/win32/
> > process.rb:3
> >         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> >         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> >         from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-
> > process.rb:1
> >         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `gem_original_require'
> >         from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> > `require'
> >         from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie.rb:45
> >         from test.rb:20
>
> > >Exit code: 1
>
> > Any one know why?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to