Hello, I am using WatiR as webtesting tool and I have seperated the
data onto a Excel file and I am using the following to connect the
workbook with testdata to the Watir script:
require 'win32ole'
excel = WIN32OLE::new("excel.Application")
workbook = excel.Workbooks.Open("C:\\Programfiler\\Ruby\\FPSdata.xls")
worksheet = workbook.WorkSheets(1) # get first workbook
value = worksheet.Range("b2").Value # get the value at cell b2 in
worksheet.
In the last line "b2" refers to a number in a Excel cell with a numer
(1200).
Executing the script this error message occurs:
:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/input_elements.rb:
390:in `limit_to_maxlength': undefined method `length' for
1200.0:Float (NoMethodError)
It seems like
"value = worksheet.Range("b2").Value"
doesn't support the format in the Excel cell, because when I try to
get another value that is a string i.e. "John"
it works fine.
Do I need to convert to string?
How would you write the code:
"value = worksheet.Range("b2").Value"
with the toString in Ruby to_s?
I hope someone can help me!
Cheers
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---