c# - geckodriver.exe 不在当前目录或路径变量中,Selenium 2.53.1 + Firefox 48 + Selenium 3 Beta

标签 c# selenium firefox selenium-webdriver selenium-firefoxdriver

看到很多关于 Selenium 2.53.1 和 Firefox 47.0.1 的问题,但没有关于 Selenium 3 Beta 版本的问题。我正在尝试使用新的 gecko/marionette Firefox 网络驱动程序,但即使我有驱动程序位置;我的环境路径,程序里的Firefox安装文件夹,在系统环境里给了驱动位置,还是不能正常运行。

错误:

geckodriver.exe 不存在于当前目录或 PATH 环境变量的目录中。可以在https://github.com/mozilla/geckodriver/releases 下载驱动程序。 .

使用:

  • Selenium 2.53.1 服务器
  • 火狐 48
  • Selenium 3 Beta DLL
  • 窗口 10

示例代码 1

    using OpenQA.Selenium.Firefox;

    public static class FirefoxInitialise
    {
         public static IWebDriver Driver {get; set;}

         Driver = new FirefoxDriver();
    }

还尝试了以下操作:

    using OpenQA.Selenium.Firefox;

    public static class FirefoxInitialise
    {
         public static IWebDriver Driver {get; set;}

         FirefoxDriverServices service = FirefoxDriverService.CreateDefaultService();
         service.FirefoxBinaryPath = @"C:\Program Files\Mozilla Firefox\firefox.exe";
         FirefoxOptions options = new FirefoxOptions();
         TimeSpan time = TimeSpan.FromSeconds(10);
         Driver = new FirefoxDriver(service, options, time);
    }

对于代码为何仍无法检测到此驱动程序的任何帮助或见解,我们将不胜感激。

最佳答案

尝试将 geckodriver.exe 放在你的路径中:C:\Users\YourName\Documents\Visual Studio 2013\Projects\seleniump\seleniump\bin\Debug

您可以在此链接找到 geckodriver.exe:

https://github.com/mozilla/geckodriver/releases

关于c# - geckodriver.exe 不在当前目录或路径变量中,Selenium 2.53.1 + Firefox 48 + Selenium 3 Beta,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39016134/

相关文章:

python - Selenium 连接错误

CSS - 使用 SVG 掩码在 Firefox 中无法正确显示

java - 当我们使用 Selenium WebDriver 启动时,Firefox 正在打开但立即终止

c# - 关于 Task.StartNew(Action<Object>, Object) 方法

C# 在 linq 上检索 where 子句

c# - 在 Paypal 中创建灵活的定期付款配置文件

c# - @Html.Value of(x=>x.Property Name) 和@Model.Property Name 有什么区别

java - selenium.attachFile(String fieldLocator, String fileLocator) 方法

python - 在 Python 上出现异常时如何将 try/except 与 Selenium Webdriver 一起使用

firefox - 使用自动脚本安装 Firefox 扩展