0
import geb.Browser
import org.openqa.selenium.firefox.FirefoxDriver

Browser.drive {
    go "google.com"
}

I run the script above and get the following error:java.lang.NoClassDefFoundError: org/openqa/selenium/TakesScreenshot

tim_yates
  • 167,322
  • 27
  • 342
  • 338
Terry Li
  • 16,870
  • 30
  • 89
  • 134
  • Have you grabbed all the requirements as [shown in the documentation](http://www.gebish.org/manual/current/intro.html#installation__usage)? – tim_yates Oct 19 '12 at 11:00
  • @tim_yates I downloaded the selenium support jar as well, but I didn't find the TakesScreenshot class. – Terry Li Oct 19 '12 at 11:02
  • yeah, I think that's in `selenium-api` – tim_yates Oct 19 '12 at 11:05
  • @tim_yates I just downloaded selenium-api and imported org.openqa.selenium.TakesScreenshot, resulting in another error:java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/BytecodeInterface8 – Terry Li Oct 19 '12 at 11:11
  • Yeah, you'll also need Groovy, as it uses that for its scripting – tim_yates Oct 19 '12 at 11:16

1 Answers1

1

As it says on the documentation page (and in it's maven info), you need:

org.codehaus.geb:geb-implicit-assertions:0.7.2
org.seleniumhq.selenium:selenium-api:2.15.0
org.seleniumhq.selenium:selenium-support:2.15.0

selenium-api depends on google guava

and selenium-support depends on junit and hamcrest

You'll also need to add groovy to the classpath as geb uses it under the covers

tim_yates
  • 167,322
  • 27
  • 342
  • 338
  • I use Netbeans and do have groovy in my classpath. Maybe it is too old? – Terry Li Oct 19 '12 at 11:25
  • What version of Groovy do you have? – tim_yates Oct 19 '12 at 11:28
  • That's probably too old... Netbeans 7.2 uses Groovy 1.8.6 I think? – tim_yates Oct 19 '12 at 11:36
  • I'm using Netbeans 7.1.2...I'm getting a newer version. – Terry Li Oct 19 '12 at 11:40
  • Fingers crossed :-) I *believe* the new Netbeans lets you upgrade the version you use as well (which s brilliant after it wallowed for years on a really old version). And 7.3 is just around the corner which (if JavaOne videos were to be believed) looks another great improvement :-) – tim_yates Oct 19 '12 at 11:42
  • Well, I didn't get the new version Netbeans. Instead I switched to Eclipse and downloaded the newest plugin for Groovy. It's working now but I still have no clue what has been going on behind the scene. Thanks for your help anyway! – Terry Li Oct 23 '12 at 02:34