【问题标题】:Gecko Driver not working in C# for Firefox browserGecko 驱动程序在 Firefox 浏览器的 C# 中不起作用
【发布时间】:2017-12-07 05:35:04
【问题描述】:

我正在尝试使用 Selenium Webdriver 和 C#.Net 为 Firefox 浏览器运行一些单元测试,但我无法做到(Chrome 和 IE11 浏览器运行顺畅)。

这是我收集的信息:

操作系统:Windows 10 企业版

Gecko驱动版本:geckodriver-v0.17.0-win32

Mozilla Firefox 版本:54.0.1(32 位)

环境路径变量已在“C:\LEO\SELENIUM C#\Firefox”下设置

代码片段:

using System;
using System.Text;
using System.Threading;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Firefox;

[TestFixture]
public class UnitTest3
{
private IWebDriver driver;
private StringBuilder verificationErrors;
private string baseURL;

[SetUp]
public void SetupTest()
{
    FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"C:\LEO\SELENIUM C#\Firefox");
    service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
    driver = new FirefoxDriver(service);
    baseURL = "http://www.dow.com";
    verificationErrors = new StringBuilder();
}

}

错误:

消息:OpenQA.Selenium.WebDriverException:无法找到匹配的功能集。

TearDown : System.NullReferenceException : 对象引用未设置为对象的实例。

堆栈跟踪:

感谢您的帮助,谢谢。

【问题讨论】:

  • 曾经能够绕过它吗?

标签: c# selenium firefox selenium-webdriver geckodriver


【解决方案1】:

首先,您需要安装和更新 Firefox:开发者版。

在你的情况下应该足够了。

Source with full guide.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-08
    • 2014-10-13
    • 1970-01-01
    • 2017-04-27
    • 2018-09-20
    • 2018-04-02
    • 1970-01-01
    • 2011-02-07
    相关资源
    最近更新 更多