에서 HtmlUnitDriver 사용 게브 테스트를 실행할 수 없습니다, 예 :와내가 예를 들어 구글 사양을 실행하고 메이븐
class GoogleHomePageSpec extends GebReportingSpec {
def "first result for wikipedia search should be wikipedia"() {
given:
to GoogleHomePage
expect:
at GoogleHomePage
when:
search.field.value("wikipedia")
then:
waitFor { at GoogleResultsPage }
and:
firstResultLink.text().startsWith "Wikipedia"
when:
firstResultLink.click()
then:
waitFor { at WikipediaPage }
}
}
GebSpec
다음
reportsDir = "target/geb-reports"
/* webdriver.*.driver system properties are set in the POM */
driver = {
new HtmlUnitDriver();
}
다음과 같은 관련 pom.xml
발췌 :
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>0.7-groovy-2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.39.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-spock</artifactId>
<version>0.9.2</version>
<scope>test</scope>
</dependency>
에서 실행하면 메시지와 함께 실패합니다.또는 IDE
:
First result for wikipedia search should be wikipedia(scratch.GoogleHomePageSpec) Time elapsed: 0.96 sec <<< ERROR!
geb.driver.DriverCreationException: failed to create driver from callback '[email protected]'
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:35)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:80)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:30)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:79)
at geb.Configuration.createDriver(Configuration.groovy:354)
at geb.Configuration.getDriver(Configuration.groovy:343)
at geb.Browser.getDriver(Browser.groovy:105)
at geb.Browser.clearCookies(Browser.groovy:483)
at geb.Browser.clearCookiesQuietly(Browser.groovy:491)
at geb.spock.GebSpec.resetBrowser(GebSpec.groovy:45)
at geb.spock.GebSpec.cleanup(GebSpec.groovy:67)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/set/ListOrderedSet
at com.gargoylesoftware.htmlunit.CookieManager.<init>(CookieManager.java:59)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:131)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.newWebClient(HtmlUnitDriver.java:289)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.createWebClient(HtmlUnitDriver.java:263)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:144)
at GebConfig.run_closure1(GebConfig.groovy:10)
at GebConfig.run_closure1(GebConfig.groovy)
at geb.driver.CallbackDriverFactory.getDriver(CallbackDriverFactory.groovy:29)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy:80)
at geb.driver.CachingDriverFactory.getDriver_closure3(CachingDriverFactory.groovy)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:30)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:79)
at geb.Configuration.createDriver(Configuration.groovy:354)
at geb.Configuration.getDriver(Configuration.groovy:343)
at geb.Browser.getDriver(Browser.groovy:105)
at geb.Browser.clearCookies(Browser.groovy:483)
at geb.Browser.clearCookiesQuietly(Browser.groovy:491)
at geb.spock.GebSpec.resetBrowser(GebSpec.groovy:45)
at geb.spock.GebSpec.cleanup(GebSpec.groovy:67)
내가 확인했고 공유지 수집 항아리가 존재하고 '실종'클래스가 포함되어 있습니다. ChromeDriver
, FirefoxDriver
및 InternetExplorerDriver
을 사용하여이 오류 메시지가 전혀 표시되지 않습니다.
유감스럽게도 환경적인 이유로 나는 HtmlUnitDriver
을 사용해야하므로이 문제에 관해 머리를 쓰고 있습니다.
의견이 있으면 감사드립니다.
EDIT 1 : Mac에서이 테스트의 일부를 성공적으로 마쳤습니다. 나머지 시간은 종료되었습니다. 그러나 위와 동일한 오류 (Windows에서 관찰 된 오류)가 표시되지 않습니다.
올바른 버전의 commons-collection 라이브러리를 얻었는지, 'ListOrderedSet' 클래스를 가지고 있는지 확인 했습니까? –
예, 종속성 해결로 인해 maven에서 가져온 jar에는 실제로 ListOrderedSet이 포함되어 있습니다. 그래서 나는 너무 혼란 스럽다. – profpfeff