Starts Chrome and provides a groovy shell to execute geb commands.
When starting to learn geb I wished to have a simple environment to try out some code snippets before using them in my functional tests. Especially when starting to learn geb it can be painful (and time-consuming) to restart your tests (including the whole application under test) if you just want to try something out.
This repositroy is created for the blogpost: Interaktive Browser-Automatisierung mit Geb und der Groovy-Shell
- Java 8
- JDK 8
JAVA_HOME
has been set up
A gradle wrapper is already included so their is no need to install gradle.
./gradlew geb-groovyshell -q
gradlew.bat geb-groovyshell -q
Inside groovy shell:
browser.go("http://www.test.example") // protocol is needed
def heading = browser.find(".heading") // finds the element with class 'heading'
heading.text() // get the heading's text
All system properties are passed to the shell.
Example: ./gradlew geb-groovyshell -q -Dwebdriver.firefox.bin="/Applications/Firefox ESR.app/Contents/MacOS/firefox-bin"
- After starting the browser you should be passed back to the groovy shell and be able to start typing your commands. If not: Most problems are caused by mismatching selenium and chrome version. You could try another combination by modifing
gebVersion
andwebdriverVersion
inbuild.gradle
and the chrome driver version instartGeb.groovy
.
See the offical selenium and geb docs for more information.