Tell me more ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

This has been asked a million times on the web, but there's no clear cut answer. I tried "-browserSessionReuse" today without any luck; my tests keep spawning new browser windows.

X:\QA\Automation\SELENIUM_SERVER>java -jar selenium-server-standalone-2.8.0.jar -log "log.txt" -browserSessionReuse -forcedBrowserMode "*googlechrome"
<snip>
13:42:25.923 INFO - Will recycle browser sessions when possible.

Maybe it's how I'm starting Selenium in my .py files?

sel = selenium('localhost', 4444, "*chrome", 'http://server/')
sel.start()

...perhaps I'm doing too many server starts?

Thanks.

share|improve this question
I don't think that's possible. afaik Selenium always uses new Window – Tarun Oct 19 '11 at 3:21
I've had the same result, and I wanted reuse at one point to check cookie values in a site test. – MichaelF Oct 19 '11 at 12:51

2 Answers

up vote 3 down vote accepted

This is possible with Selenium 2 and WebDriver. I'm not sure if it is with different versions. In Selenium 2 with WebDriver you can call webDriver = new FirefoxDriver(); which spawns a browser, and that browser will stay open for the duration of your testing, or you can choose to close it with webDriver.Quit();. I like to close my browser window between tests so that I know my tests aren't "dirty" with stored session data that could affect how the tests run, but I can see value in some targeted tests where I want to try a couple different scenarios while keeping the same session going.

share|improve this answer
Funny, I was just reading about this this morning, and I think it will solve my browser windows problem. Thank you. – Aaron Shaver Oct 19 '11 at 18:19

You can achieve it by using same selenium instance in multiple test. That requires some code design that controls start and stop selenium. We are using ISFW that provides a way using java so that's for sure it is possible with some efforts in python as well.

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.