【问题标题】:Unable to initialize chrome driver with chrome driver 85 and chrome browser version 85无法使用 chrome 驱动程序 85 和 chrome 浏览器版本 85 初始化 chrome 驱动程序
【发布时间】:2020-09-03 12:35:58
【问题描述】:

执行任何测试脚本时。 chrome 驱动程序未在 Visual Studio 2019 中初始化并引发空异常

针对 goolge.com 执行任何 selenium UI 测试用例

这是我在 Visual Studio 2019 中遇到的错误

  Message: 
    Test method  threw exception: 
    System.NullReferenceException: Object reference not set to an instance of an object.
    TestCleanup method  threw exception. System.NullReferenceException: System.NullReferenceException: Object reference not set to an instance of an object..
session not created: This version of ChromeDriver only supports Chrome version 83 (SessionNotCreated)

重现行为的详细步骤:

预期行为 chrome 驱动程序应在 Visual Studio 2019 中初始化

重现此问题的测试脚本或命令集 请提供一个测试脚本来重现您报告的问题,如果 设置比较复杂,GitHub repo 链接也可以。

环境 操作系统:Windows 10 浏览器:Chrome 版本 85.0.4183.83(官方构建)(64 位) 浏览器版本:版本 85.0.4183.83(官方构建)(64 位) 浏览器驱动版本:ChromeDriver 85.0.4183.87 语言绑定版本:C# Visual Studio 2019

【问题讨论】:

  • 驱动程序是否与 c# 可执行文件位于同一文件夹中?我认为以下行失败了: driver = new ChromeDriver(currentPath, options);
  • 查看错误日志,其中提到此版本的 ChromeDriver 仅支持 Chrome 版本 83 (SessionNotCreated)。所以我认为你必须升级chrome驱动程序或降级chrome版本。
  • @jdweng 是的,它正在使用当前目录,即我的用户文件夹。我调试了它,路径显示正确。
  • @DilipMeghwal 我有最新版本的 chrome 浏览器版本 85 和 chrome 驱动程序版本 85。我无法在这里上传我的截图。它不会让我。
  • 你是手动添加chromedriver吗?为什么不使用 nuget?

标签: c# selenium selenium-chromedriver


【解决方案1】:

问题已解决 = nuget 包未更新 chrome 驱动程序,即使它显示为最新版本。 nuget 显示最新的 chrome 驱动程序正在更新。但在 bin 文件夹中。它实际上是旧版本。我不得不重新启动我的视觉工作室并卸载 nuget 包并重新安装解决了这个问题。感谢您的帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-11
    • 2017-04-27
    • 2017-05-04
    相关资源
    最近更新 更多