简体   繁体   English

在TeamCity找不到Selenium ChromeDriver

[英]Selenium ChromeDriver not found at TeamCity

I'm having this problem: 我有这个问题:

The chromedriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. chromedriver.exe文件在当前目录或PATH环境变量上的目录中不存在。

This problem occurs ONLY at TeamCity, which is in the same machine that I'm working. 在TeamCity(我正在使用的同一台计算机上)出现此问题。 If I run the test on my machine using Visual Studio, it works. 如果我使用Visual Studio在计算机上运行测试,则可以正常运行。

I noticed that TeamCity is working at an "out" folder. 我注意到TeamCity正在“出”文件夹中工作。 Ex: 例如:

C:\TeamCity\buildAgent\temp\buildTmp\SYSTEM_MACHINE_NAME 2015-12-03 13_51_08\Out

But this "out" folder doesn't have the ChromeDriver. 但是此“出”文件夹没有ChromeDriver。 It is on 2 folders above. 它在上面的2个文件夹中。

The ChromeDrive is set to "Content/Copy Always". ChromeDrive设置为“内容/始终复制”。 I also tried "Copy if Newer". 我还尝试了“如果更新则复制”。 They aren't copied at "out" folder of TeamCity build. 它们不会复制到TeamCity构建的“ out”文件夹中。

What am I missing? 我想念什么?

private IWebDriver _driver = new ChromeDriver();

I solved by adding a [DeploymentItem] on TestClass: 我通过在TestClass上添加[DeploymentItem]解决:

[TestClass]
[DeploymentItem("chromedriver.exe")]
[DeploymentItem("IEDriverServer.exe")]
[DeploymentItem("phantomjs.exe")]
public class BaseTest
{
   ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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