My apologies...it looks like you were also trying to write data to Excel. The code I used merely ran searches from data retrieved from Excel. Sorry about that!
On Mar 11, 2:16 pm, George <george.sand...@gmail.com> wrote: > rrash586, > > Make sure you are comparing your progress to the great example here: > > http://wiki.openqa.org/display/WTR/Excel+interface+class > > A couple of things I did was to require 'Xls' after requiring > 'watir' (not sure it makes a difference though). You also want to > make sure that the Xls class is where it is supposed to be when you > require it. With your request, I don't you even need to use > write2DArray(). Anyhoo, this worked just fine for me: > > require 'watir' > require 'Xls' > > xlFile = XLS.new("C:\\scripts\\test_XLS_data.xls") #grab the data file > in the > myData = xlFile.getRowRecords('A1:A7', 'Example') # Example is the > name of the worksheet > xlFile.close > $j=0 > $array =Array.new > myData.each do |record| > ie = Watir::IE.start('google.com') > ie.text_field(:name,'q').set(record['SearchString']) # SearchString > is the column header > ie.button(:name,'btnG').click > result =ie.url > $array[$j] =result > $j=$j+1 > ie.close > sleep 5 > end > > On Mar 10, 4:47 am, rrash586 <rrash...@gmail.com> wrote: > > > Hello all actually in the below program i m trying to Retrieve data > > from one excel sheet and place that data on text field of google page > > and after click on search button will navigate to search result page > > Now i want to take this "url"(ie.url) of webpage and write it on > > other EXCEL sheet .But I m unable to add it using Xls method > > "write2DArray()" > > > How to add single element in excel sheet using "Xls"(Excel Interface > > Class) class > > > can anyone suggest me how to do it using "Xls" > > Thanks in advance > > > require 'Xls' > > require 'watir' > > > xlFile = XLS.new("D:\\test_XLS_data.xls") #grab the data file in the > > same dirrectory > > myData = xlFile.getRowRecords('Google Search Data','Example') #pull > > data records from excel > > xlFile.close > > > $j=0 > > $array =Array.new > > myData.each do |record| > > ie = Watir::IE.start('google.com') > > ie.text_field(:name,'q').set(record['SearchString']) > > ie.button(:name,'btnG').click > > result =ie.url > > $array[$j] =result > > $j=$j+1 > > ie.close > > end > > > xlFile = XLS.new("D:\\result_xls.xls") --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---