.NET是否有HtmlUnitDriver? [英] Is there an HtmlUnitDriver for .NET?
问题描述
我正在使用 Selenium的WebDriver 来运行一些 SpecFlow 对我正在从事自我教育的ASP.NET MVC应用进行测试。
I'm using Selenium's WebDriver to run some SpecFlow tests for an ASP.NET MVC app I'm working on for self-education.
使用 FirefoxDriver
, ChromeDriver
等都需要很长时间才能运行,因此使用它们实际上令人沮丧(我认为) 。
Using FirefoxDriver
, ChromeDriver
, etc. all take so long to run, it's actually pretty frustrating to use them (in my opinion).
我已经读过有关 HtmlUnitDriver
据说比基于浏览器的驱动程序快得多;但我似乎无法在.NET客户端库(仅Java)中找到版本。是否有.NET版本?
I have read about an HtmlUnitDriver
that is supposedly much faster than the browser-based drivers; but I can't seem to find a version in the .NET client library (only Java). Is there a .NET version out there?
推荐答案
要使用HtmlUnit,您需要使用RemoteWebDriver并传递所需的功能以用于
To use HtmlUnit you need to use the RemoteWebDriver and pass in the desired capabilities for it.
IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.HtmlUnit())
然后就走了。如果要运行Firefox实现,请使用
and away you go. If you want the Firefox implementation to run use
IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.HtmlUnitWithJavaScript())
这篇关于.NET是否有HtmlUnitDriver?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!