[英]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.当我在 Visual Studio 中停止测试执行时,我想从任务管理器中关闭 webdriver。 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.
通常我可以使用 AfterTestRun 关闭驱动程序,但是,当我在 Visual Studio 中单击停止按钮同时测试执行正在运行 AfterTestRun 没有执行,所以 web 驱动程序仍然是打开的。
You can't do this, as Visual Studio/Test Explorer is killing the test execution process when you stop the execution.您不能这样做,因为当您停止执行时,Visual Studio/Test Explorer 正在终止测试执行过程。 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:您可以通过 Windows 上的命令行以这种方式终止进程:
taskkill /f /im chromedriver.exe
taskkill /f /im chromedriver.exe
This kills all processes with the name chromedriver.exe.这会杀死所有名为 chromedriver.exe 的进程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.