简体   繁体   English

在 specflow 中从 Visual Studio 停止测试执行时关闭 webdriver

[英]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.

相关问题 如何在 Visual Studio Code 中调试 specflow 测试 - how to debug specflow test in Visual Studio Code SpecFlow - Visual Studio的HTML输出 - SpecFlow - HTML output from Visual Studio 在Visual Studio中扩展Specflow - Extension for Specflow in visual studio 在Visual Studio中进行调试时,硒测试执行顺序会更改 - Selenium test execution order chnges when debugging in Visual Studio 使用 Specflow 时覆盖自定义异常的测试执行状态 - Overriding test execution status for a custom exception when using Specflow 如何强制Visual Studio *真正*停止执行? - How to force Visual Studio to *really* stop execution? 尝试清除 specflow BDD 测试错误:未找到测试程序集。 请构建项目以启用 SpecFlow Visual Studio 扩展功能 - Trying to clean specflow BDD test error: Test assembly not found. Please build the project to enable the SpecFlow Visual Studio Extension features 在Visual Studio 2010中执行负载测试的时间 - Load test execution time in visual studio 2010 Specflow Visual Studio C# - 如何 IWebdriver 在新窗口上恢复另一个场景的执行 - Specflow Visual studio C# - How to IWebdriver resume the execution of another scenario on a new window 使用SpecFlow,xUnit和Headless Chrome并行执行测试 - Parallel test execution with SpecFlow, xUnit and Headless Chrome
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM