简体   繁体   中英

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.

This problem occurs ONLY at TeamCity, which is in the same machine that I'm working. If I run the test on my machine using Visual Studio, it works.

I noticed that TeamCity is working at an "out" folder. 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. It is on 2 folders above.

The ChromeDrive is set to "Content/Copy Always". I also tried "Copy if Newer". They aren't copied at "out" folder of TeamCity build.

What am I missing?

private IWebDriver _driver = new ChromeDriver();

I solved by adding a [DeploymentItem] on TestClass:

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

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