我创建了3个测试服务器,IE,Chrome和Firefox。在TeamCity中,我创建了3个构建配置IE,Chrome和Firefox。我有3个Agent AgentIE,AgentChrome和AgentFirefox。
每个代理都分配给特定的构建配置示例构建配置IE是针对AgentIE的
当我运行Build Configuration Firefox时,所有测试都会执行,但是当我运行Build Configuration IE时,Chrome测试不会被执行。错误消息表明IE和Chrome exe不存在但我跟着exe文件存在于目录和PATH环境变量的目录中。
MSTest的]
Framework.FeatureFiles.AdditionalFieldsFeature.CreateNewAdditionalField_0001 (Create New Additional Field: 0001)
[10:35:53][Framework.FeatureFiles.AdditionalFieldsFeature.CreateNewAdditionalField_0001 (Create New Additional Field: 0001)] Assembly Initialization method Framework.BaseClasses.Base.InitWebdriver threw exception. OpenQA.Selenium.DriverServiceNotFoundException: OpenQA.Selenium.DriverServiceNotFoundException: The chromedriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html.. Aborting test execution.
[10:35:53][Framework.FeatureFiles.AdditionalFieldsFeature.CreateNewAdditionalField_0001 (Create New Additional Field: 0001)] at OpenQA.Selenium.DriverService.FindDriverServiceExecutable(String executableName, Uri downloadUrl)
at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService()
at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
at Framework.BaseClasses.Base.GetChromeDriver() in C:\TeamCity\buildAgent\work\eba5cd3c0056fc6a\Framework\BaseClasses\Base.cs:line 61
at Framework.BaseClasses.Base.InitWebdriver(TestContext tc) in C:\TeamCity\buildAgent\work\eba5cd3c0056fc6a\Framework\BaseClasses\Base.cs:line 84
如果我在teamcity服务器上运行的代理上运行Chrome构建配置,则会执行测试。
问题在于特定机器上的路径变量。
我有完全相同的问题,我可以通过执行以下步骤解决它:
你可以下载the latest Chrome Driver here。
Here are some instructions on how to add variable to the path。