Put your begin and rescue inside the loop and remove the retry.
Charley Baker blog: http://blog.charleybaker.org/ Lead Developer, Watir, http://wtr.rubyforge.org QA Architect, Gap Inc Direct On Mon, Jul 27, 2009 at 5:24 AM, Satya <satyajit.prad...@gmail.com> wrote: > > I am writing a script to check links on a specific page. I am getting > the list of pages(URL’s) from an excel file. The issue that I am > facing is once the loop starts and an exception is encountered the > execution stops, so I have put a ‘retry’ in the exception section. But > the issue is it again starts the whole loop execution. > Eg. In the excel file I have stored 5 URL’s to test and exception is > encountered at 3 URL then the loop starts from the 1 URL again. > > I want it to start from 4th URL of the excel file (not from 3rd since > I know there is some issue as the expectation was raised) > > ========= > The script that I have written: > > xlFile = XLS.new("C:/LinkChecker/Data/BusinessUnits.xls") > CreateBU = xlFile.getRowRecords('create_bu','create_bu') > > $ie = IE.new > > $ie.goto("url to my application") > > Login($username,$pwd) > > > begin > CreateBU.each do |record| > i =0 > > $ie.goto(record['BUName']) > > links = Array.new > $ie.links.each do |link| > > $ie.goto(link.href) > > if(i > 0) > $ie.goto(record['BUName']) > puts i > end > i = i + 1 > > end > sleep(5) > end > > end > > rescue Exception => msg > puts("The exception is " + msg) > retry > ensure > close_resultFile($result) > xlFile.close > > end > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---