当我尝试访问 text 属性时发生错误:
#Here is where my error occurs
$password=wrksheet.cells(rows,"B") ['text']
上下文中的完整示例:
#require "C:\Ruby193\lib\ruby\gems\1.9.1\gems\rack-1.4.0\lib\rack\logger.rb"
require "watir"
require "watir-webdriver"
require "test/unit"
require "win32ole"
class TC_Login < Test::Unit::TestCase
browser = Watir::Browser.new :ff
browser.goto "gaana.com"
#browser.driver.manage.timeouts.implicit_wait = 10
browser.a(:class,"closeBtn").wait_until_present
browser.a(:class,"closeBtn").click
def test_login
#Define the excel file
excel= WIN32OLE::new("excel.Application")
wrkbook=excel.Workbooks.Open("C:\\data\\test.xls")
wrksheet = wrkbook.worksheets(1)
wrksheet.select
#read the data from excel file
rows = 2
while rows <= 9
#Here is where my error occurs
$password=wrksheet.cells(rows,"B") ['text']
puts $field
$username=wrksheet.cells(rows,"A") ['text']
$fullname=wrksheet.cells(rows,"C") ['text']
browser.a(:id,"joinus").click
browser.text_field(:id,"fullname").set($fullname)
browser.text_field(:id,"email").set($username)
browser.text_field(:id,"Password").set($password)
browser.a(:id, "save" ).click
rows=rows+1
end
end
end