I write some code for Reading data from excel file and put into the
google.
but they give error plz help me.
ERROR:
Excel.rb:16: warning: already initialized constant Keyword
Excel.rb:17: warning: already initialized constant Object_Prop_Name
Excel.rb:18: warning: already initialized constant Object_Prop_Value
Excel.rb:19: warning: already initialized constant Expected_Output
Excel.rb:20: warning: already initialized constant Parm_01
Excel.rb:16: warning: already initialized constant Keyword
Excel.rb:17: warning: already initialized constant Object_Prop_Name
Excel.rb:18: warning: already initialized constant Object_Prop_Value
Excel.rb:19: warning: already initialized constant Expected_Output
Excel.rb:20: warning: already initialized constant Parm_01
Excel.rb:16: warning: already initialized constant Keyword
Excel.rb:17: warning: already initialized constant Object_Prop_Name
Excel.rb:18: warning: already initialized constant Object_Prop_Value
Excel.rb:19: warning: already initialized constant Expected_Output
Excel.rb:20: warning: already initialized constant Parm_01
require 'watir'
include Watir
begin
#Open Excel File
excel = WIN32OLE::new('excel.Application')
excel.DisplayAlerts = false
workbook = excel.Workbooks.Open('C:\test\POC.xls')
#Loop through the worksheets
for i in 1 .. workbook.Worksheets.Count
  worksheet = workbook.Worksheets(i)
  rowcount = worksheet.UsedRange.Rows.Count
  for j in 2..rowcount
    Keyword =worksheet.Cells(j, 1).value
    Object_Prop_Name = worksheet.Cells(j, 2).value
    Object_Prop_Value = worksheet.Cells(j, 3).value
    Expected_Output = worksheet.Cells(j, 4).value
    Parm_01 = worksheet.Cells(j, 6).value
    case Keyword
      when /^OpenURL/
      ie=IE.start(Parm_01)
      #~ @Browser.maximize
      when /^SetText/
      ie.text_field(:"#{Object_Prop_Name}",
Object_Prop_Value).set(Parm_01)
      when/^ClickButton/
     ie.button(:"#{Object_Prop_Name}", Object_Prop_Value).click
     when/^ClickLink/
    ie.link(:"#{Object_Prop_Name}", Object_Prop_Value).click
    when/^CloseURL/
    ie.close
    end
end
end
workbook.Close()
excel.quit()
  rescue
  workbook.Close()
  excel.quit()
end
Attachments:
http://www.ruby-forum.com/attachment/4726/POC.xls
···
--
Posted via http://www.ruby-forum.com/.