I'm taking my first steps in Geb, using the documentation as a guideline. And not making much progress (I am using Groovy 2.4.5).
The first attempt was to run this script, which we could maybe consider to be the "hello world" script for Geb:
@Grapes([
@Grab("org.gebish:geb-core:0.13.0"),
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.50.1"),
@Grab("org.seleniumhq.selenium:selenium-support:2.50.1")
])
import geb.Browser
Browser.drive {
assert title == "Geb - Very Groovy Browser Automation"
$("#sidebar .sidemenu a", text: "jQuery-like API").click()
assert $("#main h1")*.text() == ["Navigating Content", "Form Control Shortcuts"]
assert $("#sidebar .sidemenu a", text: "jQuery-like API").parent().hasClass("selected")
}
This results in:
Caught: BUG! exception in phase 'conversion' in source unit
So I modified the script with the workaround suggested in the bug:
@Grapes([
@Grab("org.gebish:geb-core:0.13.0"),
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.50.1"),
@Grab("org.seleniumhq.selenium:selenium-support:2.50.1"),
])
import geb.Browser
Browser.drive {
assert title == "Geb - Very Groovy Browser Automation"
$("#sidebar .sidemenu a", text: "jQuery-like API").click()
assert $("#main h1")*.text() == ["Navigating Content", "Form Control Shortcuts"]
assert $("#sidebar .sidemenu a", text: "jQuery-like API").parent().hasClass("selected")
}
Result:
Caught: java.lang.NoSuchFieldError: INSTANCE
java.lang.NoSuchFieldError: INSTANCE
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.<clinit>(SSLConnectionSocketFactory.java:144)
at org.openqa.selenium.remote.internal.HttpClientFactory.getClientConnectionManager(HttpClientFactory.java:71)
at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:57)
at org.openqa.selenium.remote.internal.HttpClientFactory.<init>(HttpClientFactory.java:60)
at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.getDefaultHttpClientFactory(ApacheHttpClient.java:251)
at org.openqa.selenium.remote.internal.ApacheHttpClient$Factory.<init>(ApacheHttpClient.java:228)
at org.openqa.selenium.remote.HttpCommandExecutor.getDefaultClientFactory(HttpCommandExecutor.java:96)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:70)
at org.openqa.selenium.remote.HttpCommandExecutor.<init>(HttpCommandExecutor.java:58)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:97)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:216)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at geb.driver.NameBasedDriverFactory.getDriver(NameBasedDriverFactory.groovy:44)
at geb.driver.CachingDriverFactory$_getDriver_closure3.doCall(CachingDriverFactory.groovy:85)
at geb.driver.CachingDriverFactory$_getDriver_closure3.doCall(CachingDriverFactory.groovy)
at geb.driver.CachingDriverFactory$SimpleCache.get(CachingDriverFactory.groovy:32)
at geb.driver.CachingDriverFactory.getDriver(CachingDriverFactory.groovy:84)
at geb.Configuration.createDriver(Configuration.groovy:382)
at geb.Configuration.getDriver(Configuration.groovy:371)
at geb.Browser.getDriver(Browser.groovy:108)
at geb.Browser.go(Browser.groovy:498)
at geb.Browser$go$1.callCurrent(Unknown Source)
at geb.Browser.go(Browser.groovy:488)
at t1$_run_closure1.doCall(t1.groovy:9)
at t1$_run_closure1.doCall(t1.groovy)
at geb.Browser.drive(Browser.groovy:1061)
at geb.Browser$drive$0.callStatic(Unknown Source)
at geb.Browser.drive(Browser.groovy:1031)
at geb.Browser$drive.call(Unknown Source)
at t1.run(t1.groovy:8)
But now I'm stuck. Any help is appreciated.
Thanks,
Michael