Case Step:
Note: Those two steps should be run in one test of TestNG XML.
If you don't want both driver session be active but want to switch to another driver by kill current driver session you can set driver.name
property in code and it will do the needful. Changing any of following property in code teardowns existing driver and creates new driver instance:
driver.name
driver.additional.capabilities
remote.server
remote.port
For example:
getBundle().setProperty("driver.name","chromeDriver");
//do the needful
getBundle().setProperty("driver.name","anotherDriver");
//it will teardown chromedriver and create anotherDriver session in next driver call.
//do the needful
If you want to have both driver session to be active, Support for Multiple driver in the same thread/test-case has been added since 2.1.11. To change driver within test case you can use setDriver(String driverName)
method of QAFTestBase. For instance:
TestBaseProvider.instance().get().setDriver("chromeDriver");`
Refer details in commit notes.