How to quit Firefox using FireWatir on a Mac

There seems to be a bug in the way that FireWatir on the mac quits firefox… it doesn’t! When you try, you end up with a dialog box saying:

Close Firefox
A copy of Firefox is already open. Only one copy of Firefox can be open at a time.

Here it is…

close_firefox

These dialog boxes pile up on top of each other during a test run; a few minutes into the run it looks like the dialog box is surrounded by a big black band!

To get around the problem and kill firefox reliably, you can use the following method. It simply calls the killall command line app and tells it to kill the firefox process. Here’s the method:


def kill_mac_firefox_browser
  `killall -9 firefox-bin`
end

Brutal but effective.

BTW, here’s how to kill a process by name using ruby on windows; the example used is how to kill firefox too!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>