Below is my code where i try to find the text from the excel sheet and click that 'text' on the application. Once done I want to color that particular cell(where the text is located ) in green color.
require 'rubyXL'
require 'roo'
workbook = Roo::Spreadsheet.open(file_name)
workbook1 = RubyXL::Parser.parse(file_name) workbook.default_sheet='Left navigation'
worksheet1 = workbook1['Left navigation']
for j in (workbook.first_row..workbook.last_row)
for k in (workbook.first_column..workbook.last_column)
if(k==1)
choose("lookupSearch", :option => "Plan")
fill_in "searchInput", :with => workbook.cell(j,k)
find(:xpath, '//*[@id="searchicon"]').click
elsif(workbook.cell(j,k)=='.')
puts "Completed"
else
find('a', text: workbook.cell(j,k), :match => :prefer_exact)
worksheet1.sheet_data[j][k].change_fill ('008000')
end
end
end
Error message is "undefined method `[]' for nil:NilClass (NoMethodError)"
Note : When I use worksheet1.sheet_data[j-1][k-1].change_fill ('008000') there is no error .But still green color is not there on the cell. Unable to trace . Please Advice