简体   繁体   中英

Close webdriver when stop test execution from visual studio in specflow

I would like to close webdriver from task manager, when I stop test execution in visual studio. Normally I could use AfterTestRun to close the driver, but, when I click over stop button in visual studio meanwhile test execution is running AfterTestRun isn't execute, so web driver is still open.

You can't do this, as Visual Studio/Test Explorer is killing the test execution process when you stop the execution. No code is executed then and there is also no place where you could put some code that gets executed.

I have a command line script that kills all the processes when I press a shortcut.

You can kill a process via command line on Windows this way:

taskkill /f /im chromedriver.exe

This kills all processes with the name chromedriver.exe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM