I am very close, this finds the links but errors on a variable and the .txt 
file is empty



#-------------------------------------------------------------------------------------------------------------#
#
#  I'm  a Pretty Flower Box
#
#
#
#------------------------------------------------------------------------------------------------------------#

   require 'watir'   # the watir controller

   # set a variable
   test_site = 'http://www.google.com'
  # set the log file
  textlog = File.open("text.log", File::CREAT|File::APPEND|File::WRONLY)
    
   # open the IE browser
   ie = Watir::IE.new
   # print some comments
   puts "## Beginning of test: Google search"
   puts "  "
        ie.goto(test_site)
        puts "  Action: entered " + test_site + " in the address bar."
      ie.text_field(:name, "q").set("Beer + Bottle + Label")       # q is the 
name of the search field
   puts "Step 3: click the 'Google Search' button"
   ie.button(:name, "btnG").click   # "btnG" is the name of the Search button
   puts "  Action: clicked the Google Search button."

   puts "Expected Result: "
   puts " - a Google page with results should be shown."
     puts "Iterate thru links on page a pull them into txt file "
         puts "Test Passed. Found the test string: 'Beer Bottle Label'."
      ie.links.each do |link| # for each link on the current page in IE...
        textlog.puts link.src # print url of the link in the textlog we
        created end
        # createdtextlog.puts "Here's some stuff"

   puts "## End of test: Google search"
      if ie.contains_text("Beer + Bottle + Label")  
      else
      puts "Test Failed!" 
   end
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to