I'm new to Geb and trying to do a quick test to evaluate it before further use. Due to proxy permissions etc I would like to do so without using Grape. Therefore, I have attempted to download the required jars manually and am attempting to specify them on the command line.
However when doing so I receive the following class not found for WebDriverException:
C:\geb-test>groovy -cp geb-core-0.9.2.jar;selenium-htmlunit-driver-2.35.0.jar;selenium-support-2.35.0.jar GoogleTest
Caught: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriverException
java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriverException
at GoogleTest.run(GoogleTest.groovy:3)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.WebDriverException
... 1 more
C:\geb-test>
Do I require additional jars? If so which ones? I've tried a few others but with no joy - as I noted WebDriverException is in selenium-api-2.35.0.jar, but it made no difference.
So, here's the details starting with some version information:
- Groovy Version: 2.1.7 JVM: 1.7.0_40 Vendor: Oracle Corporation OS: Windows 7
To start with, I'm using the simple geb inline scripting example which I've put in a file called GoogleTest.groovy:
import geb.Browser
Browser.drive {
go "http://google.com/ncr"
// make sure we actually got to the page
assert title == "Google"
// enter wikipedia into the search field
$("input", name: "q").value("wikipedia")
// wait for the change to results page to happen
// (google updates the page dynamically without a new request)
waitFor { title.endsWith("Google Search") }
// is the first link to wikipedia?
def firstLink = $("li.g", 0).find("a.l")
assert firstLink.text() == "Wikipedia"
// click the link
firstLink.click()
// wait for Google's javascript to redirect to Wikipedia
waitFor { title == "Wikipedia" }
}
Then based on the geb install instructions I made sure I had the jars mentioned in the @Grab annotations. This resulted in my test directory having the following files:
07/11/2013 10:46 <DIR> .
07/11/2013 10:46 <DIR> ..
06/11/2013 14:51 460,165 geb-core-0.9.2.jar
06/11/2013 15:13 711 GoogleTest.groovy
06/11/2013 14:55 56,189 selenium-htmlunit-driver-2.35.0.jar
06/11/2013 14:54 130,535 selenium-support-2.35.0.jar
4 File(s) 647,600 bytes
And then for completeness, I attempt the above mentioned command line execution:
C:\geb-test>groovy -cp geb-core-0.9.2.jar;selenium-htmlunit-driver-2.35.0.jar;selenium-support-2.35.0.jar GoogleTest
Caught: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriverException
java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriverException
at GoogleTest.run(GoogleTest.groovy:3)
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.WebDriverException
... 1 more
C:\geb-test>
I'm starting to wonder if the issue is multiple jars with Groovy '-cp' commandline. I'm now attempting to put the jars in the ${user.home}.groovy\lib directory. But then I end up with an not defined class for GebException. Maybe you have to use Grape to have any chance of getting this working. :/ Let me know.