【问题标题】:Why is selenium producing this error?为什么硒会产生此错误?
【发布时间】:2012-07-13 00:06:40
【问题描述】:

我正在使用 selenium 2.0.3(来自 nuget 包)进行一些浏览器测试。这在我的本地加工中都可以正常工作。

在我们的 TFS 构建机器上运行 selenium 测试时出现以下错误。

System.IO.FileLoadException : Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.

如何确保已加载此程序集。它在项目中没有被引用,但 selenium 需要它。

更新

我不知道我做了什么,但它现在有效....这是一个谜。抱歉,我无法发布解决方案,我不知道它是什么。

【问题讨论】:

    标签: tfs selenium selenium-webdriver json.net


    【解决方案1】:

    您需要在构建服务器上安装 selenium 2.0.3 及其所有依赖项。

    谢谢

    M.拉德万

    【讨论】:

    • 或者您可以在实验室机器上安装测试代理并在该机器上运行测试。
    【解决方案2】:

    在此处查看我关于管理构建时依赖项的答案: Dependency management with TFS 2010

    您可以在构建过程中使用 NuGet 命令行工具来更新您的依赖项,只需对 *.*proj 文件进行简单修改即可。

    【讨论】:

      【解决方案3】:

      现在(从 2.2.0 版开始)有一个来自 Selenium 团队的官方 NuGet 包,可以在 this link 找到。它应该包含正确的依赖项。如果您决定使用project site 上的 .zip 文件分发,则需要引用 JSON.NET 4.0r2 中的 Newtonsoft.Json.Net35.dll 和 DotNetZip 1.9 中的 Ionic.Zip.Reduced.dll。

      【讨论】:

        猜你喜欢
        • 2021-03-29
        • 2012-01-03
        • 2016-03-29
        • 2015-09-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-03-17
        • 1970-01-01
        相关资源
        最近更新 更多