Selenium测试项目C#没有运行Chrome

Tur*_*tik 6 c# selenium google-chrome selenium-webdriver

我在运行chrome时要求进行selenium测试但我遇到了Exception.帮我恳求.我的代码是:

using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using OpenQA.Selenium.Support.UI;
using System.Text;
using System.Threading;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome; 

namespace Acceptance_Test.Trader
{
    [TestFixture]
    public class AcceptenceTestBtcTraderCom
    {
        private IWebDriver _driver;
        private StringBuilder _verificationErrors;
        private string _baseUrl;


        [SetUp]
        public void SetupTest()
        {
            _driver = new ChromeDriver(); // ** exception location is this one.
Run Code Online (Sandbox Code Playgroud)

WebDriver.dll中出现"OpenQA.Selenium.DriverServiceNotFoundException"类型的例外但未在用户代码中处理附加信息:chromedriver.exe文件不存在于当前目录或PATH环境变量的目录中.该驱动程序可以从chromedriver.storage.googleapis.com/index.html下载

Sha*_*air 19

您需要添加chrome驱动程序的路径:

_driver = new ChromeDriver("C:\\Folder_with_Chrome_driver");
Run Code Online (Sandbox Code Playgroud)

如果您还没有下载驱动程序,可以在此处找到它.