Hi all

 I have written a script, in which from an excel file a value will get
enter in the text field "ie.text_field(:name, "productName").set
$worksheet.Range("a#{i}").value"

My script:

require 'watir'
include Watir

    $excel_path = "D:/Data/dportalTestScripts/Product.xlsx"
    $sheet_id   = 1
    $excel = WIN32OLE.new("excel.application")
    $excel['Visible'] = true;
    $workbook = $excel.Workbooks.Open $excel_path
    $worksheet = $workbook.WorkSheets($sheet_id)
    $worksheet.Select

 ie = Watir::IE.new
 ie.goto("http://test.com";)
 ie.text_field(:name, "userName").set("a")
 ie.text_field(:name, "password").set('d')
 ie.button(:value, "Login").click
 ie.image(:name, 'toplogo_nav_08_off').click
 ie.link(:text, "Manage Products").click
 ie.link(:text, "Create Product").click

ie.text_field(:name, "productName").set $worksheet.Range("a#
{i}").value

I get the error when my script gets to this point (ie.text_field
(:name, "productName").set $worksheet.Range("a#{i}").value)

D:\Data\dportalTestScripts>"Create Multiple Product.rb"
d:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./watir.rb:4005:in
`doKeyPress': undefined method `length' for nil:NilClass
(NoMethodError)
        from d:/ruby/lib/ruby/gems/1.8/gems/watir-1.5.1.1230/./
watir.rb:3986:in `set'
        from D:/Data/dportalTestScripts/Create Multiple Product.rb:50

Does anyone know if my problem is the length of the field name or ?
Is there any way around the problem? The length of the field name is
100

Thanks in advance for any help you can provide!

--~--~---------~--~----~------------~-------~--~----~
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