Skip to content

Latest commit

 

History

History
55 lines (32 loc) · 1.92 KB

README.md

File metadata and controls

55 lines (32 loc) · 1.92 KB

Interactive Geb shell

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

Requirements

  • Java 8
  • JDK 8
  • JAVA_HOME has been set up

A gradle wrapper is already included so their is no need to install gradle.

Usage

Starting the shell

Unix

./gradlew geb-groovyshell -q

Windows

gradlew.bat geb-groovyshell -q

Example

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

Config

All system properties are passed to the shell.

Example: ./gradlew geb-groovyshell -q -Dwebdriver.firefox.bin="/Applications/Firefox ESR.app/Contents/MacOS/firefox-bin"

Troubleshooting

  • 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 and webdriverVersion in build.gradle and the chrome driver version in startGeb.groovy.

See the offical selenium and geb docs for more information.