From: Joel Pearson Date: 2012-11-27T22:46:47+09:00 Subject: Re: Few unclosed browser ajay paswan wrote in post #1086565: > Joel Pearson wrote in post #1086482: >> Try closing with this instead of checking for nil first, it seems more >> reliable: >> >> br.close rescue nil > What is the diffrence? This will attempt to close the browser even if it is nil, it just removes the chance of the "if" statement missing something. >> I'd also add that line before "br=Watir::Browser.new :ie", just in case >> there's something there. > even if something is there.. it will get overwritten..right? If there is something there, the window might remain open, and webdriver could open a new window while abandoning the old one. >> When all else fails, there's always this option: >> >> require 'sys/proctable' >> Sys::ProcTable.ps.each { |ps| >> Process.kill('KILL', ps.pid) if ps.name.downcase == "iexplore.exe" >> } > > How to do this for ff and chrome? I mean the equivalent code for ff and > chrome? Look in the task manager. Firefox is "firefox.exe" -- Posted via http://www.ruby-forum.com/.