【发布时间】: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