[英]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.