views:

99

answers:

4

My Google-fu is weak and so I turn to the hive mind...

I have a Selenium script I originally developed in the IDE, which I am now trying to adapt to run on IE8 via Selenium-RC. I'm trying to debug an error where an element is not being found.

The problem is that as soon as the error occurs, the script exits and RC closes the browser. This makes it a bit hard to poke around with Firebug, etc, to see what is going on under the covers.

In the IDE, I could simply set a breakpoint. Is there a way to freeze the state of RC and the browser when an error occurs?

Any other ideas?

Thanks!

+1  A: 

I am running selenium rc tests as part of my test suite, so I just fire up --pdb (in python) and script pauses when exception occurs - before tearDown that closes the browser is invoked.

I have also had a plugin where I took a screenshot when something went wrong.

Almad
+2  A: 

Depending on how you're running your RC tests, you could set a breakpoint in your IDE and run the test in debug mode. For example I use Eclipse to run tests using Java. Another option is to put a long pause in your test, just make sure you remove it again afterwards..!

Dave Hunt
A: 

If you are using JUnit and SeleniumTestCase, you can add an empty tear down method to your test code which should prevent the browser from shutting down by overriding the base SeleniumTestCase tear down method. I use this on failing tests which I need to examine the resulting browser state after a failure.

Chris Knight
A: 

In these situations I comment out the selenium.close() and selenium.stop() commands in my code which stops the browser from closing. IIRC screenshot is only supported for firefox, so that won't help in your case.

she-ra