由于 VS 在 ChromeDriver 上持有锁,无法在 Visual Studio 2013 年进行 运行 顺序 Selenium 测试

Unable to run sequential Selenium tests in Visual Studio 2013due to VS holding a lock on ChromeDriver

在 Visual Studio 2013 Ultimate(在 windows 10 机器上尝试 运行 一小部分 selenium 测试时,我一直在与间歇性的以下错误作斗争在 C# 中。)

Warning 1 Could not copy "C:\Users\t3sk0\Documents\Visual Studio 2013\Projects\UnitTestProject1\UnitTestProject1\Dependencies\chromedriver.exe" to "bin\Release\Dependencies\chromedriver.exe". Beginning retry 1 in 1000ms. The process cannot access the file 'bin\Release\Dependencies\chromedriver.exe' because it is being used by another process. UnitTestProject1

快速 google 和 Whosebug 搜索将我带到了一个已知问题,该问题似乎自 2010 年以来就一直存在,但没有具体的解决方案。只是来自社区的一些奇怪的解决方法。这个问题发生的次数多于没有发生的次数。

有谁知道实际的解决方案吗?这真的让我慢下来,让我发疯!谢谢!

错误说:

The process cannot access the file 'bin\Release\Dependencies\chromedriver.exe' because it is being used by another process

转到任务管理器杀死所有挂起的 chromedriver 进程,或者重新启动机器并再次 运行 测试。

为避免此错误,请在测试结束时使用 driver.quit()

示例:http://www.mkyong.com/selenium/many-chromedriver-exe-are-left-hanging-on-windows-selenium/