尝试启动Firefox驱动程序时出错 [英] Error On Trying To Launch Firefox Driver

查看:161
本文介绍了尝试启动Firefox驱动程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请,当我编写一些代码以启动firefox驱动程序时出现此错误:

Please, I get this error when I write some code to launch the firefox driver:

================================================ ==================================

==================================================================================

WebDriver.dll中发生了类型为'OpenQA.Selenium.DriverServiceNotFoundException'的未处理异常

An unhandled exception of type 'OpenQA.Selenium.DriverServiceNotFoundException' occurred in WebDriver.dll

其他信息:geckodriver.exe文件在当前目录或PATH环境变量上的目录中不存在.可以从 https://github.com/mozilla/geckodriver/releases 下载该驱动程序.

Additional information: The geckodriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at https://github.com/mozilla/geckodriver/releases.

这是代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using System.Threading.Tasks;


namespace FireFox_Driver_Launch
{
    class Program
    {
        static void Main(string[] args)
        {

            var Driver = new FirefoxDriver();
            Driver.Navigate().GoToUrl("http://www.starwoodhotels.com/preferredguest/account/enroll/index.html");

        }
    }
}

================================================ =================

================================================================

我还从"Manager Nuget软件包"中添加了硒webdriver软件包.

I have added the selenium webdriver package from "Manager Nuget Packages" as well.

我已经搜索了该网站&谷歌寻求解决方案.但是,我还没有解决方案.

I have searched this site & Google for a solution. But, I have not gotten a solution yet.

firefox浏览器已安装在PC上.

The firefox browser is installed on the PC.

我已经下载了geckodriver.拜托,我该如何将其放入PATH中?

I have downloaded the geckodriver. Please, how do I put it in the PATH?

我相信应该在系统环境变量中吗?

I believe it should be in the System Environment variables ?

谢谢您的帮助.

推荐答案

您需要按照错误消息中的说明安装GeckoDriver.最简单的方法是添加Selenium.Firefox.WebDriver nuget软件包以及已经安装的Selenium.WebDriver.

You need to install the GeckoDriver as is stated in the error message. The easiest way to do that is to add the Selenium.Firefox.WebDriver nuget package as well as the Selenium.WebDriver that you already have installed.

这篇关于尝试启动Firefox驱动程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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