views:

383

answers:

6

Howdy.

I've been running my selenium tests using selenium rc for about 6 months and suddenly the firefox windows selenium opens do not close when the test is finished.

I am using a specific firefox profile and had not updated my selenium rc jar. I thought that perhaps the latest build of firefox may have been the problem but I reverted back to firefox 2 and the windows still stay open.

I'm running the test on a Windows box.

I've noticed other people seem to be having this problem - just wondering if anyone has a solution?

Thanks, Gearoid.

A: 

We use Microsoft's freely available sysinternals pskill tool to kill the browser (including firefox) process.

By executing pskill "firefox.exe" that will kill a FireFox window.

If you need to execute that on a remote machine, you can use [psexec][3]. Also for both there are command switches to automatically accept the EULA (-accepteula) so you don't have to.

Zugwalt
+1  A: 

Very simple solution in the end - just called SeleniumTestCase's tearDown() method (ie. we call super.tearDown(); from our base test class)

That closes down all the browser windows successfully.

Gearóid
A: 

Gearóid: I cannot see how that would solve the problem. super.tearDown() is called automatically after each test case any way, so making an additional call would only make it run twice.

I have noticed that the browser windows do not shut down until the Selenium server is stopped. So, in my case, if there are 100 selenium tests, I would have 200 Firefox windows open before they are eventually closed when the Selenium server exits.

(I am running Fedora 13 and Firefox 3.6.7)

jogrimst
A: 

Hello. I'm having the same problem in windows and FF3.6.8. I think it's something to do with selenium's configuration. Did you solve your problem?

Arnuz
A: 

Using TestNG, you can precede the teardown() function with an @AfterMethod, or an @AfterTest annotation, instead of @AfterClass.

Rajat
A: 

We had this problem and after some investigation we fixed it.

In Selenium RC you have the file "grid_configuration.yml" where you have the list of browsers and their respective identifier, for instance "*firefox". Depending of your environment when you execute "firefox" you'll be probably calling a wrapper, an alias or a symbolic link of the firefox executable file. When Selenium is launched, it creates some fork process for the browser and depending if you are calling the firefox executable file directly or a wrapper, the creation of these process is different and when it tries to kill the process in the tearDown() it actually kills the child process and keep the father alive, so the tearDown() doesn't close the browser.

The solution is edit the "grid_configuration.yml" file changing "*firefox" for the absolute path of the browser executable file (always with * at the beginning)

VictorTuenti