<tfoot id='W6Rg1'></tfoot>

<small id='W6Rg1'></small><noframes id='W6Rg1'>

  • <legend id='W6Rg1'><style id='W6Rg1'><dir id='W6Rg1'><q id='W6Rg1'></q></dir></style></legend>
    <i id='W6Rg1'><tr id='W6Rg1'><dt id='W6Rg1'><q id='W6Rg1'><span id='W6Rg1'><b id='W6Rg1'><form id='W6Rg1'><ins id='W6Rg1'></ins><ul id='W6Rg1'></ul><sub id='W6Rg1'></sub></form><legend id='W6Rg1'></legend><bdo id='W6Rg1'><pre id='W6Rg1'><center id='W6Rg1'></center></pre></bdo></b><th id='W6Rg1'></th></span></q></dt></tr></i><div id='W6Rg1'><tfoot id='W6Rg1'></tfoot><dl id='W6Rg1'><fieldset id='W6Rg1'></fieldset></dl></div>
    • <bdo id='W6Rg1'></bdo><ul id='W6Rg1'></ul>

        Selenium WebDriver.ChromeDriver Nuget 包已安装,但不适用于 MSTest

        时间:2023-09-14

        <legend id='7x38o'><style id='7x38o'><dir id='7x38o'><q id='7x38o'></q></dir></style></legend>
            <i id='7x38o'><tr id='7x38o'><dt id='7x38o'><q id='7x38o'><span id='7x38o'><b id='7x38o'><form id='7x38o'><ins id='7x38o'></ins><ul id='7x38o'></ul><sub id='7x38o'></sub></form><legend id='7x38o'></legend><bdo id='7x38o'><pre id='7x38o'><center id='7x38o'></center></pre></bdo></b><th id='7x38o'></th></span></q></dt></tr></i><div id='7x38o'><tfoot id='7x38o'></tfoot><dl id='7x38o'><fieldset id='7x38o'></fieldset></dl></div>

                <tbody id='7x38o'></tbody>
              • <bdo id='7x38o'></bdo><ul id='7x38o'></ul>

                  <small id='7x38o'></small><noframes id='7x38o'>

                  <tfoot id='7x38o'></tfoot>

                  本文介绍了Selenium WebDriver.ChromeDriver Nuget 包已安装,但不适用于 MSTest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已添加 WebDriver.ChromeDriver nuget打包到我的解决方案中,其中包含 Selenium WebDriver 使用 Chrome 运行自动化测试所需的 ChromeDriver.exe 文件.查看包内容,它只包含以下文件:

                  I have added the WebDriver.ChromeDriver nuget package to my solution, which contains the ChromeDriver.exe file, required for Selenium WebDriver to run automated tests using Chrome. Looking at the package contents, it just contains the file following file:

                  toolschromedriver.exe

                  应该 要做的就是将此文件夹添加到 PATH 环境变量中,以便可以通过以下代码访问 chromedriver.exe(这是在 UnitTest 项目中)使用 MSTest):

                  What this is supposed to do is add this folder to the PATH environment variable so that chromedriver.exe is accessible via the following code (this is in a UnitTest project using MSTest):

                  [TestMethod]
                  public void LaunchWebsite_Chrome()
                  {
                       // create ChromeDriver - this should work if chromedriver.exe 
                       // is known to the environment PATH variable
                       IWebDriver driver = new ChromeDriver();
                  
                       driver.Navigate().GoToUrl("http://localhost/");
                  }
                  

                  但是,我仍然遇到以下异常:

                  However, I am still getting the following exception:

                  chromedriver.exe 文件不存在于当前目录或 PATH 环境变量的目录中.驱动程序可以在 http://code.google.com/p/chromium/downloads 下载/列表.

                  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://code.google.com/p/chromium/downloads/list.

                  查看 nuget 文档,它表明 nuget 包的 tools 文件夹中的任何内容都会自动添加到 PATH 环境变量中:

                  Looking at the nuget documentation, it suggests that anything in the tools folder of the nuget package will get added to the PATH environment variable automatically:

                  http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package:包的 tools 文件夹用于存放可从包管理器控制台访问的 powershell 脚本和程序.文件夹复制到目标项目后,添加到`$env:Path (PATH) 环境变量中.

                  http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package: The tools folder of a package is for powershell scripts and programs accessible from the Package Manager Console. After the folder is copied to the target project, it is added to the `$env:Path (PATH) environment variable.

                  但是,这似乎不起作用.我什至在命令行上运行了 echo %PATH%,但它没有显示我的工具文件夹已注册.

                  However, this doesn't seem to be working. I have even run echo %PATH% on the command line and it doesn't show my tools folder as registered.

                  我做错了什么?

                  推荐答案

                  我不会为此烦恼 NuGet 包,因为这不是一个类库 - 从技术上讲,这就是 NuGet 的全部意义所在.自该版本发布以来,ChromeDriver 也进行了多次更新.

                  I wouldn't bother with the NuGet package for this, simply because this is not a class library - which is technically, what NuGet is all about. ChromeDriver has also been updated many times since that release.

                  无论如何,我会说我刚刚做了同样的事情来看看问题是什么:

                  Anyway, I would say that I have just done the same thing to see what the issue is:

                  1. 下载 NuGet 包
                  2. 使用 Visual Studio,通过右键单击项目 -> 添加项目 -> 现有项目,将新项目添加到项目中
                  3. 导航并选择 chromedriver.exe
                  4. 更改属性以确保复制到输出目录"设置为始终复制.

                  您可能在第 4 点上落伍了.该设置默认设置为 不复制.

                  You are probably falling down on point 4. That setting is set to Do not copy by default.

                  这篇关于Selenium WebDriver.ChromeDriver Nuget 包已安装,但不适用于 MSTest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Selenium Google ChromeDriver 中禁用图像 下一篇:Selenium ChromeDriver 如何禁用消息:"DevTools on ws

                  相关文章

                  <legend id='NNqZP'><style id='NNqZP'><dir id='NNqZP'><q id='NNqZP'></q></dir></style></legend>

                    <i id='NNqZP'><tr id='NNqZP'><dt id='NNqZP'><q id='NNqZP'><span id='NNqZP'><b id='NNqZP'><form id='NNqZP'><ins id='NNqZP'></ins><ul id='NNqZP'></ul><sub id='NNqZP'></sub></form><legend id='NNqZP'></legend><bdo id='NNqZP'><pre id='NNqZP'><center id='NNqZP'></center></pre></bdo></b><th id='NNqZP'></th></span></q></dt></tr></i><div id='NNqZP'><tfoot id='NNqZP'></tfoot><dl id='NNqZP'><fieldset id='NNqZP'></fieldset></dl></div>
                      • <bdo id='NNqZP'></bdo><ul id='NNqZP'></ul>
                    1. <tfoot id='NNqZP'></tfoot>

                      <small id='NNqZP'></small><noframes id='NNqZP'>