Home > watir > Close all other browser in watir

Close all other browser in watir

October 8th, 2008 Leave a comment Go to comments

I used to close some browsers by following code:

puts “to close a certain previous browser”
Watir::IE.attach(:title, /google/).close
puts “to close a certain previous browser”
Watir::IE.attach(:title, /Internet/).close
puts “to close a certain previous browser”
Watir::IE.attach(:title, /Internet/).close

but when 2 or more watir programs run together, they stalled there. I don’t know the reason, so I tried the following code which worked ok:

sleep 1
puts “to close all the other browsers”
ie77.close_others
sleep 1
puts “to close current browser”
ie77.close



Categories: watir Tags:
  1. No comments yet.
  1. No trackbacks yet.
      
                  
      

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word