Selenium WebDriver C# 测试脚本中不存在 ChromeDriver [英] ChromeDriver does not exist in Selenium WebDriver C# test script

查看:38
本文介绍了Selenium WebDriver C# 测试脚本中不存在 ChromeDriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到过一些有同样问题的人,他们似乎用 System.addProperty("webdriver.chrome.driver", ".../chromedriver.exe"); 解决了这个问题. 在实例化驱动程序之前.

I have come across a few people with the same issue that seemed to have solved the problem with System.addProperty("webdriver.chrome.driver", ".../chromedriver.exe"); before instantiating the driver.

我在这方面运气不佳,但仍然收到文件 .../bin/Debug/chromedriver.exe 不存在的错误.

I have had little luck with this and am still getting the error that the file .../bin/Debug/chromedriver.exe does not exist.

有没有人在不将其放入 bin 文件夹的情况下运行它?

Has anyone had any luck getting this to run without putting it in the bin folder?

示例代码:

System.Environment.SetEnvironmentVariable("webdriver.chrome.driver", @"c:\path\to\driver\chromedriver.exe");
BrowserDriver = new ChromeDriver();

推荐答案

旧问题,新答案(对于它的价值):只需安装 Nuget 包 Selenium.WebDriver.ChromeDriver.Chromedriver.exe 将在下一次构建的目录 bin/debug 中.

Old question, new answer (for what it's worth): just install the Nuget package Selenium.WebDriver.ChromeDriver. Chromedriver.exe will be in the directory bin/debug on the next build.

在这个 github 页面 jsakamoto/nupkg-selenium-webdriver-chromedriver/ 运行 Install-Package Selenium.WebDriver -Version 3.5.2 后,chromedriver(.exe) 位于此文件夹下方

On this github page jsakamoto/nupkg-selenium-webdriver-chromedriver/ that after running Install-Package Selenium.WebDriver -Version 3.5.2 the chromedriver(.exe) lies below this folder

" {solution 文件夹}/packages/Selenium.WebDriver.ChromeDriver. {ver}/driver/{平台}"

" {solution folder} /packages/Selenium.WebDriver.ChromeDriver. {ver} /driver/ {platform}"

这篇关于Selenium WebDriver C# 测试脚本中不存在 ChromeDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆