Search code examples
seleniumqaf

How to quit driver in qaf bdd2


I am usung qaf bdd2 framework for test automation. I have a requirement where I need to run the test cases in specific port so I have implemented below as qaf listeners

options.setExperimentalOption("debuggerAddress", "127.0.0.1:9222");

Now the issue is when I run any multiple scenerios I expect the browser to open at beginning of scenerio and close at end of scenerio and it should continue the same way while running other scenerios. After implementing to run chrome in specific port the browser opens but not closing at all. When new scenerio runs, the browser opening a new tab and running the test which I don't want to run in same tab. When test completed the browser is not closing automatically I need to close it manually.

Question: how to implement driver.quit() and where in qaf I need to apply to close browser for every scenerio?


Solution

  • I found the answer. I forcing the chrome driver by using taskkill and calling it on finish using ItestListeners.

    Code: taskkill /f /im chromedriver.exe