user221256
user221256

Reputation:

Close and open a new browser in Selenium

I'm writing a script which needs the browser that selenium is operating close and re-open, without losing its cookies.

Any idea on how to go about it?

Basically, it's a check to see that if the user opens and closes his browser, his cookies stay intact.

Upvotes: 1

Views: 1413

Answers (2)

Dave Hunt
Dave Hunt

Reputation: 8223

You should be able to use the stop and start commands. You will need to ensure that you are not clearing cookies between sessions, and depending on the browser you're launching you may also need to use the -browserSessionReuse command line option.

Upvotes: 3

Aaron Digulla
Aaron Digulla

Reputation: 328624

This is a feature of the browser and not your concern: If there is a bug in the browser, then there is little you can do. If you need to know whether a certain version of the browser works correctly, then define a manual test (write a document that explains the steps), do it once and record the result somewhere (like "Browser XXX version YYY works").

When you know that a certain browser (version) works, then that's not going to change, so there is no need to repeat the test.

Upvotes: 0

Related Questions