I would recommend learning ruby. and using spreadsheets probably not the best way to go about creating data. there several gems out there that can help you
On Thu, Feb 13, 2014 at 10:27 AM, Super Kevy <[email protected]>wrote: > TRY: > http://roo.rubyforge.org/ and search the group for this topic > also search xls.rb and read excel in this group you'll find hints and > methods > > > > I personally use xls.rb https://github.com/bash0C7/XLS/blob/master/xls.rb > xls.rb exists all over the web. > I put this and an excel spreadsheet in my program folder so paths are > relative > > I setup up a worksheet with column headers and row data, name it as a range > For example Sheet1 has data in A1: B4 and is ranged named logins > > | userName | password | > | 001 | thePassword | > | 002 | thePassword2 | > | 1002 | anypw | > > > > ################################ > #Sample code > # > ################################ > > require 'rubygems' > require 'watir-webdriver' > require "watir-webdriver/extensions/alerts" > require 'win32ole' > require 'fileutils' > require 'date' > require './xls.rb' > > > # This uses stuff in xls.rb > def xls_GetTheRowData(sSpreadSheet,sRange,sSheetName) > xlFile = XLS.new(Dir.pwd + '/'+sSpreadSheet) #grab the data file in the > same dirrectory > myData = xlFile.getRowRecords(sRange,sSheetName) > #'A4..AC39','ApplicantData') #pull data records from excel > xlFile.close > return myData > end > > sSpreadSheet='./spreadsheet.xls' > sSheetName = 'Sheet1' > sRange = 'logins' # Cells A1:B3 > > myHash = {} > myHash = xls_GetTheRowData(sSpreadSheet,sRange,sSheetName) > puts ' - Number of rows found: '+myHash.length().to_s > puts ' - Return (hash): '+myHash.length().to_s > > #Now to get data loop the hash or use the index with fetch > > puts myHash[1].fetch('userName') > puts myHash[1].fetch('password') > > myHash.each do | theRow | > puts theRow.fetch('userName').to_s > puts theRow.fetch('password').to_s > # Now assume they can be added to a form > ie.text_field(:id,'login').set(theRow.fetch('userName').to_s) > ie.text_field(:id,'password').set(theRow.fetch('password').to_s) > # Rest of logic, like save > end > > > -- > -- > Before posting, please read http://watir.com/support. In short: search > before you ask, be nice. > > [email protected] > http://groups.google.com/group/watir-general > [email protected] > > --- > You received this message because you are subscribed to the Google Groups > "Watir General" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
