简体   繁体   English

使用.NET C#的Selenium Firefox木偶驱动程序

[英]Selenium Firefox Marionette Driver with .NET C#

I've been using Selenium ( http://www.seleniumhq.org/ ) recently for testing purposes. 我最近一直在使用Selenium( http://www.seleniumhq.org/ )进行测试。 It randomly stopped working and I believe this is due to Selenium WebDriver 2.53.0 not being compatible with Firefox 47 anymore (the WebDriver component which handles Firefox browsers (FirefoxDriver) has been discontinued). 它随机停止工作,我相信这是由于Selenium WebDriver 2.53.0不再与Firefox 47兼容(处理Firefox浏览器的WebDriver组件(FirefoxDriver)已经停产)。

Marionette ([ https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver#.NET][2] ) is the next generation of FirefoxDriver and I've been trying to get this to work on my machine but have had no luck. Marionette([ https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver#.NET] [2 ] )是FirefoxDriver的下一代产品,我一直试图将其转化为在我的机器上工作,但没有运气。

I have so far downloaded the driver, renamed the file as wires.exe and saved in the root directory of my website. 到目前为止我已经下载了驱动程序,将文件重命名为wires.exe并保存在我网站的根目录中。 I have then added the following code: 然后我添加了以下代码:

string strWires = @"Z:\Web_Development\Websites\test\wires.exe";
Environment.SetEnvironmentVariable("webdriver.gecko.driver", strWires);

FirefoxOptions options = new FirefoxOptions();
options.IsMarionette = true;
FirefoxDriver driver = new FirefoxDriver(options);

I recieve the following error message however: 但是我收到以下错误消息:

"An exception of type 'OpenQA.Selenium.DriverServiceNotFoundException' occurred in WebDriver.dll but was not handled in user code “WebDriver.dll中出现'OpenQA.Selenium.DriverServiceNotFoundException'类型的例外,但未在用户代码中处理

Additional information: The wires.exe file does not exist in the current directory or in a directory on the PATH environment variable. 附加信息:wires.exe文件不存在于当前目录或PATH环境变量的目录中。 The driver can be downloaded at github.com/jgraham/wires/releases." 该驱动程序可以从github.com/jgraham/wires/releases下载。“

It would be very much appreciated if anyone knows how to get the Marionette driver working with Selenium (or could even just point me in the right direction) and could provide step by step instructions? 如果有人知道如何让Marionette驱动程序与Selenium合作(或者甚至可以指向正确的方向)并且可以提供分步说明,那将非常感激。

Thanks, 谢谢,

Daniel 丹尼尔

Marionette seems to want to use the nightly build of FireFox. Marionette似乎想要使用FireFox的每晚构建。 Download Geckodriver, rename it to wires.exe, copy to output. 下载Geckodriver,将其重命名为wires.exe,复制到输出。 This works for me (FireFox 47 and Selenium 2.53.0): 这对我有用(FireFox 47和Selenium 2.53.0):

var driverService = FirefoxDriverService.CreateDefaultService();
driverService.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
driverService.HideCommandPromptWindow = true;
driverService.SuppressInitialDiagnosticInformation = true;

var driver = new FirefoxDriver(driverService, new FirefoxOptions(), TimeSpan.FromSeconds(60));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 c#Selenium 2.53在firefox升级到47后转移到牵线木偶驱动程序 - c# Selenium 2.53 moving to marionette driver after firefox upgrade to 47 更新到木偶驱动程序C# - Updating to Marionette Driver C# Selenium - FireFox / Marionette驱动程序没有做等待。直到 - Selenium - FireFox/Marionette driver not doing wait.Until C#:使用木偶驱动程序选择下拉项目 - C#: Selecting Dropdown Items with Marionette Driver 在主机服务器c#上运行firefox Selenium驱动程序 - Running firefox Selenium driver on Hosting Server c# 如何检查Selenium C#中是否打开了Firefox驱动程序? - How to check if the Firefox Driver is opened in Selenium C#? 在 C# 最新 3.9.0 上让 Selenium 与 Firefox 驱动程序一起工作 - Getting Selenium to Work with Firefox Driver on C# Latest 3.9.0 Selenium - Visual Studios- C# - 所有(chrome、firefox 和 Internet Explorer)webdrivers 无法启动驱动程序服务 - Selenium - Visual Studios- C# - All (chrome, firefox, and internet explorer) webdrivers unable to start driver service Selenium:Firefox驱动程序,在C#中使用SelectElement从下拉列表中选择一项无法正常工作 - Selenium : Firefox Driver, Selecting an item from a dropdown using SelectElement in c# not working correctly C# - Selenium - firefox驱动程序无法捕获并应用AcceptInsecureCerts(2018/02/08最新发布) - C# - Selenium - firefox driver fails to capture and apply AcceptInsecureCerts (2018/02/08 Latest Releases)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM