使用HtmlUnitDriver运行黄瓜测试

时间:2011-11-16 14:55:21

标签: selenium cucumber bdd webdriver htmlunit

当我使用FirefoxDriver运行我的测试时我没有任何问题,但是当我将FirefoxDriver更改为HtmlUnitDriver时会发生以下错误:

[INFO]   java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.startsWithIgnoreCase(Ljava/lang/String;Ljava/lang/String;)Z (NativeException)
[INFO]   com/gargoylesoftware/htmlunit/util/URLCreator.java:66:in `toUrlUnsafeClassic'
[INFO]   com/gargoylesoftware/htmlunit/util/UrlUtils.java:193:in `toUrlUnsafe'
[INFO]   com/gargoylesoftware/htmlunit/util/UrlUtils.java:171:in `toUrlSafe'
[INFO]   com/gargoylesoftware/htmlunit/WebClient.java:162:in `<clinit>'
[INFO]   org/openqa/selenium/htmlunit/HtmlUnitDriver.java:284:in `newWebClient'
[INFO]   org/openqa/selenium/htmlunit/HtmlUnitDriver.java:255:in `createWebClient'
[INFO]   org/openqa/selenium/htmlunit/HtmlUnitDriver.java:131:in `<init>'
[INFO]   org/openqa/selenium/htmlunit/HtmlUnitDriver.java:174:in `<init>'
[INFO]   org/openqa/selenium/htmlunit/HtmlUnitDriver.java:170:in `<init>'

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

答案是: http://www.mail-archive.com/jwebunit-users@lists.sourceforge.net/msg01390.html

您可能正在使用较旧版本的commons-lang。使用2.4或更高版本。