2

I am learning about GEB and i would like to play around with it in Groovy console. I am tying to run:

import geb.Browser

Browser.drive {
 go "http://googel.com/"
 assert title == "Google"
}

But this gives an error

unable to resolve class geb.Browser
 at line: 1, column: 1

I have downloaded Geb core jar (http://search.maven.org/#artifactdetails%7Corg.codehaus.geb%7Cgeb-core%7C0.7.2%7Cjar) and put it in the PATH, but is not importing in the groovy console. What am i doing wrong and how to run the simple Geb inline scripting?

Thank you

p.s. mac 10.7, geb 0.7.2

1 Answer 1

6

Try putting that at the top of your file :

@Grapes([
    @Grab("org.codehaus.geb:geb-core:0.7.2"),//always use latest version of geb and selenium drivers
    @Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.46.0"),
    @Grab("org.seleniumhq.selenium:selenium-support:2.46.0")
])

Then, you won't have to deal with classpath issues and you'll got geb in groovy console easily

3
  • This doesn't work for me. Firefox pops up, but it won't actually navigate anywhere. Jun 16, 2015 at 11:35
  • 1
    @RobertFischer It might be different issue, check if your firefox work with webdriver, and then try with geb. Alos check if U got latest driver version.
    – SkorpEN
    Jun 23, 2015 at 7:37
  • Yeah, I needed to wait for Selenium to come up with a new Firefox driver to match with my new Firefox version. Jun 24, 2015 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.