小编top*_*tts的帖子

在C#最新3.9.0上使Selenium与Firefox驱动程序一起使用

我无法让Selenium与c#上的Firefox驱动程序一起使用。Chrome可以完美运行,但Firefox无法运行。

使用方法:

  • 网络框架4.6.1
  • 硒的最新版本3.9.0
  • 壁虎驱动程序(从管理Nuget软件包)下载0.19.1
  • 使用MSTest.TestAdapater,它应该与Chrome一样完美运行。

我已经在Windows中设置了path变量。

GeckoDriver已安装在源代码的Bin文件夹中。

Firefoxdriverservice不存在,因此无法使用该命令。

我收到的错误是“ 引发异常:System.ComponentModel.Win32Exception:系统找不到指定的文件

using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using System.Windows.Forms;

 namespace BeatRecaptcha
{
[TestClass]
public class UnitTest1
{
    [TestMethod]
    public void TestMethod1()
    {

        IWebDriver driver = new FirefoxDriver();
        driver.Manage().Window.Maximize();

        //Go to Google
        driver.Navigate().GoToUrl("www.google.co.uk");

    }
}
Run Code Online (Sandbox Code Playgroud)

}

c# firefox selenium geckodriver

1
推荐指数
1
解决办法
6766
查看次数

标签 统计

c# ×1

firefox ×1

geckodriver ×1

selenium ×1