I’m trying to set up some tests for a website that has a forum. As a result, many of these things need to be done in succession, including login, creating and removing threads, etc.
At the moment I’ve devised test cases using Selenium, and exported to Python with webdriver.
Is it possible to use only one webdriver instance between all tests so they can be executed in succession? I am rather new to python (coming from Java) so the only idea I had was to create a base class that would instantiate the webdriver, have all tests subclass the base, and have the webdriver passed to the tests. (I want to just do this in Java but I’m forcing myself to learn some Python).
Or is there another feature built into Selenium that will accomplish this?
Thanks for your time.
I managed to get it working by having a base class my tests would subclass. This base class would create a static driver that would be setup once by the setUp() method and returned to following tests.
And then the two tests I ran…
Test #2 to be run in succession…
My testsuite.py I would run…
This is my first exposure to Python so if there are any glaring issues, I’d appreciate feedback.