1

I have created a testsuite which has 2 testcases that are recorded using selenium in firefox. Both of those test cases are in separate classes with their own setup and teardown functions, because of which each test case opens the browser and closes it during its execution.

I am not able to use the same web browser instance for every testcase called from my test suite. Is there a way to achieve this?

Net Myth
  • 441
  • 1
  • 5
  • 14
  • Please refer to following questions: http://stackoverflow.com/questions/23735885/can-we-have-static-variable-for-initilizing-driver-in-selenium-web-driver http://stackoverflow.com/questions/19067885/static-webdriver-instance-synchronization-in-java – Kumar Sourav Nov 17 '16 at 09:33

1 Answers1

1

This is how is suppose to work.
Tests should be independent else they can influence each other.

I think you would want to have a clean browser each time and not having to clean session/cookies each time, maybe now not, but when you will have a larger suite you will for sure.

Each scenario has will start the browser and it will close it at the end, you will have to research which methods are doing this and do some overriding, this is not recommended at all.

lauda
  • 4,153
  • 2
  • 14
  • 28