Sign up ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.

when the tests fail, the browser that the selenium tests were running on closes. this is unhelpful when trying to debug. i know i have the option of a screen shot upon failure, but that doesn't help without the entire context. with the browser still available, i can hit back and inspect what was going on.

is there a way to keep the browser open even when asserts fail or elements aren't found?

share|improve this question

3 Answers 3

up vote 9 down vote accepted

figured it out randomly many weeks later.

when starting the server, use the option -browserSessionReuse at the end. this will keep one browser session open throughout the tests and not close on failure

share|improve this answer

You might be calling selenium.stop() at the end of the test. You need to comment out that line of code and make sure that your selenium object is not destroyed at the end of the test. This will keep the window open. Same question has been answered here

share|improve this answer

Regarding the answer about -browserSessionReuse at http://stackoverflow.com/a/6904808/654026, keep in mind that you will have to deal with cleaning the cookies between tests executions. Otherwise you may have difficult to debug errors.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.