Groovy based DSL that provides a framework for testing web sites or site scraping.
Geb needs a Groovy IDE. Eclipse Neon takes a bit of TLC to use groovy:
Adding stuff is easy using the marketplace, but could go a lot quicker (if you know what you need).
Download the following update archive to a fixed location and remember the location: http://download.springsource.com/release/TOOLS/update/3.6.4.RELEASE/e4.5/springsource-tool-suite-3.6.4.RELEASE-e4.5-updatesite.zip
Go to Help → Install new Software
Add a new update site, use: http://dist.springsource.org/snapshot/GRECLIPSE/e4.6/
From that update site, install:
Groovy Compiler 2.1 Feature
Groovy Compiler 2.2 Feature
Groovy Compiler 2.3 Feature
Groovy Compiler 2.4 Feature
Groovy-Eclipse Feature
JDT Core patch for Groovy-Eclipse plugin on Eclipse 4.6
Confirm restarting Eclipse
Add a new update site, use ‘Archive’ to point to the archive downloaded earlier (give it a name for you to recognize)
From that update site, install only the following: Core / Grails IDE for Eclipse → Grails IDE
Confirm restarting eclipse
For easy searching, add a new update site, use: http://dist.springsource.com/release/TOOLS/update/e4.6/
From that update site, install:
Eclipse Quicksearch
Add the gradle plugin
Open Help | install new software
Work With: http://download.eclipse.org/releases/neon
Select "Buildship: Eclipse plug-ins for Gradle" under "General Purpose tools"
Ok, we’re done.
The result is a lightweight version of Eclipse completely usable and perfect for maintaining those Grails 2 applications that you might have.
Download a suitable WebDriver executable from the selenium site (under "Third Party Drivers, Bindings, and Plugins").
Create a Gradle Project.
Add the following Geb specific dependencies (Check for latest versions) to the dependencies stanza in build.gradle at the root of your new project:
compile "org.gebish:geb-core:1.0"
compile "org.seleniumhq.selenium:selenium-chrome-driver:2.52.0"
compile "org.seleniumhq.selenium:selenium-support:2.52.0"
Create a file called "${project_base_dir}/src/main/java/GebConfig.groovy".
For Chrome populate with the following code (other driver types are shown here):
import org.openqa.selenium.chrome.ChromeDriver
driver = {
System.setProperty('webdriver.chrome.driver', 'C:\\location\\of\\chromedriver_win32\\chromedriver.exe')
new ChromeDriver()
}
There arent many objects provided by Geb, but they are quite powerful
The primary object. It connects to a WebDriver instance that is specifically for the browser you want to work with
Interesting attributes for
Content
Declaring a