suppose a client starts a selenium session on an RC server, but at the middle of the session the client "went away". The browser will remain open, and eventually, after enough such dropped sessions, there will be enough "orphan" browsers to slow down the computer.
Client libraries that provide an interface between each one of the programming languages (Java, C#, Perl, Python and PHP) and the Selenium-RC Server.
Selenium RC is a key part in Selenium. It is a framework for testing that allows testers and developers to design test scripts in multiple languages to automate frontend UI test cases. It has a client library and a server that starts and quits the browser sessions by default.
Any browser instance has a session_id you can store. Python example:
>>> import selenium
>>> browser = selenium.selenium("localhost",4444, "*firefox", "http://www.santiycr.com.ar")
>>> browser.start()
>>> browser.sessionId
u'b4ad1f1d624e44d9af4200b26d7375cc'
So, if you store these sessionId in a file when your test starts and then remove it when your tests ends, you'll have a log file with sessions for tests that didn't end up properly.
Now using cron, or any regular execution, you can read that file, iterate over the sessionIds stored in it and open the following url (using a browser or even an http library for your programing language):
http://localhost:4444/selenium-server/driver/?sessionId=THE-SESSION-ID&cmd=testComplete
That should do the trick.
Edit: I found this question so interesting that created a post in my blog about the solution. If you're a python guy you'll find it interesting: http://www.santiycr.com.ar/djangosite/blog/posts/2009/aug/25/close-remaining-browsers-from-selenium-rc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With