Ian, Reloading probably invalidates the table object, resulting in your "Access denied" error when ruby goes back for the next row in the table.
Suggestion: Assuming that submitting and reloading doesn't affect the table layout, use rows.each_with_index to build an array of indices of relevant rows. Then cycle through the array clicking and submitting. For instance (untested, unfortunately): rows_to_click = Array.new ie.table(:index, 29).rows.each_with_index do |row, i| rows_to_click << i if (row[1].text =~ /#{journals}/) != nil end rows_to_click.each do |i| [Do the clicking and such for row i here.] end This could be made substantially prettier, but hopefully it gets the job done. Ethan On 5/4/07, Ian Webb <[EMAIL PROTECTED]> wrote: > Here's the code snippet that's giving me problems: > > ie.table(:index,29).each do |row| > if (row[1].text =~ /#{journals}/) != nil then #If there is a match > for that regex > row[5].link(:index,1).click # this makes the popup window appear > cw = Watir::IE.attach(:title,'Popup Window') # attach to the popup > window > doRolesPopup(cw) # fill out and submit the form > end > end > > doRolesPopup fills out a form in the cw page, then clicks submit. The > submit button submits the form, then closes the cw window and reloads > the ie window. This reload of the page referenced by the ie object > appears to break the row object, since I get the following error: > > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `invoke': unknown > property or method `rows' (WIN32OLERuntimeError) > HRESULT error code:0x80070005 > Access is denied. from > c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2461:in `row' > from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `each' > from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `upto' > from c:/ruby/lib/ruby/site_ruby/1.8/watir.rb:2404:in `each' > from assignroles.rb:51 > from c:/ruby/lib/ruby/1.8/csv.rb:532:in `parse' > from c:/ruby/lib/ruby/1.8/csv.rb:560:in `each' > from c:/ruby/lib/ruby/1.8/csv.rb:531:in `parse' > from assignroles.rb:35 > > Is there any way to keep this simple .each loop, or do I need to work > around it? > > Thanks, > Ian > _______________________________________________ > Wtr-general mailing list > Wtr-general@rubyforge.org > http://rubyforge.org/mailman/listinfo/wtr-general > _______________________________________________ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general