Here is what I have so far. It opens the Excel sheet, but doesn't write anything to it.
require 'watir' # the watir controller require 'win32ole' # set a variable test_site = 'http://www.google.com' result1 = 'Default' # open the IE browser ie = Watir::IE.new # print some comments puts "## Beginning of test: Google search" puts " " puts "Step 1: go to the test site: " + test_site ie.goto(test_site) puts " Action: entered " + test_site + " in the address bar." puts "Step 2: enter 'sitewire' in the search text field" ie.text_field(:name, "q").set("sitewire") # q is the name of the search field puts " Action: entered sitewire in 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. 'Programming Ruby' should be high on the list." puts "Actual Result: Check that the 'Programming Ruby' link appears on the results page " if ie.contains_text("Accelera") puts "Test Passed. Found the test string: 'Programming Ruby'. Actual Results match Expected Results." result1 = "PASS Test" else puts "Test Failed! Could not find: 'Programming Ruby'" result1 = "FAIL TEST" end puts " " puts "## End of test: Google search" # -end of simple Google search test #open spreadsheet excel = WIN32OLE.new("excel.application") excel.visible = true # in case you want to see what happens workbook = excel.workbooks.add #Log results excel.worksheet.range("a1").value = "Test Results for Sitewire" excel.worksheet.range("b1").value = result1 # # Etcetera...assume the above happens 4 times, for 4 screens... # #Format workbook columns #worksheet.range("b1:b4").Interior['ColorIndex'] = 36 #pale yellow excel.worksheet.columns("b:b").AutoFit #close the workbook excel.workbook.saveas('c:\watir\examples\spreadsheet99TEST.xls') excel.workbook.close excel.Quit Stacaz --------------------------------------------------------------------- Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=5462&messageID=15230#15230 _______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
