I am currently automating tests with selenium RC which run every hour. Everything runs smoothly most of the time but there are some times where either firefox will crash or the selenium RC will just hang and because of these two issues the testing is not continued and is stalled. Does anyone know how I can make the firefox.exe and or java.exe(selenium instance) be killed when they do crash or hang, so testing can resume. The problems I see is detecting automatically when firefox or selenium is hanging and kill it via a script automatically.
thanks!
close() closes only the current window on which Selenium is running automated tests. The WebDriver session, however, remains active. On the other hand, the driver. quit() method closes all browser windows and ends the WebDriver session.
Exception Handling in Selenium Exceptions are faults or disruptions that occur during the execution of a program/application. Exception handling is crucial for maintaining the natural or normal flow of the application. Selenium exceptions can be broadly categorized into two types: Checked and Unchecked Exceptions.
Selenium automation testing with Python can be the best decision ever. It has many advantages of using Python over Java for Selenium testing. 1. Python is an easy and a productive language than Java.
Ideally, each of your tests will be starting from a clean state, with no existing Firefox or IE processes running. In your test tearDown() methods, you should be closing / exiting your browsers. Even with this approach, sometimes, stray processes can still creep in. If you are running your Selenium server on Windows, via Java RC, putting this command in your tests' startUp() method can help ensure no browsers / instances are running:
Runtime.getRuntime().exec("TASKKILL /F /IM Firefox.exe");
Runtime.getRuntime().exec("TASKKILL /F /IM iexplore.exe");
As far as detecting when they crash, Firefox will display an alert dialog indicating a crash. You can programatically interact with this window via external tools, such as AutoIT, which can automatically press the "OK" button on this dialog if you need. I've found that building an external AutoIT script that runs constantly in the background to handle popups, crashes, warnings, etc, is very helpful.
Not sure I have the ultimate answer for you, but I can offer some ideas:
(Se pushes us to terrible extremes: We actually wrote a ssh job triggered in TeamCity that logged into a windows machine and restarted the selenium server there. Ultimately we didn't use it.)
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