Category Archives: geb

How to run a Grails 3 App with IntelliJ?

This post explains how to run a Grails 3 App with IntelliJ as described in the Grails 3 IntelliJ Quickcast by Jeff Scott Brown Using Application.groovy It is easy to run a Grails 3 App directly from IntelliJ. Execute the main method in Application.groovy. Just click the green arrow. Please, make sure you turn off […]

How to access Cookies with Geb?

Lets say we visit the Codemotion agenda; an upcoming Conference in Spain. We can check whether the website stores any cookies. As shown below it does: Let say we want to access those cookies with Geb. Web Driver to the rescue. Geb builds on the WebDriver browser automation library, which means that Geb can work […]

How to execute Geb with different browsers

Add Groovy dependency to build.gradle Add Gradle wrapper add Geb, Selenium, Drivers and Spock depependencies to build.gradle Create a test src/test/groovy/gebwebbot/greach/LegalSpec.groovy We are going to create a Geb.Config file to leverage Geb environment sensitivity. vi src/test/resources/GebConfig.groovy Pass Java system properties from the command-line to the gradle test task. In order to do that modify our […]

Obtain current page html source?

Geb manual: Geb builds on the WebDriver browser automation library, which means that Geb can work with any browser that WebDriver can. With WebDriver is easy to obtain the page source. Lets do a test to verify it. Lets start by creating a Gradle project with Groovy Add Groovy dependency to build.gradle Add Gradle wrapper […]

Hidden Content and Mouse over Events

Lets say we have an HTML page with content hidden until we place the mouse over it. It will look like this: And this is the html If I try to fetch the content with Geb, it will fail because it is hidden. Next test fails. We have several alternatives: A. Call a JS method […]

User Agent Spoofing

As often happens on the internet there is already a website to answer your question. If you would like to know what’s your user agent just visit whatsmyuseragent.com If you run Geb with PhantomJs your user agent will identify you as running PhantomJs. You may be blocked because of that. Fortunately it is easy to […]

How to run Geb with PhantomJS Driver in desktop size

If you are developing your Geb programms with Firefox or Chrome driver, they will probably be running in a traditional desktop resolution. You may be puzzled when your tests fail in PhantomJS driver. Why? After further investigation you will probably realise that the tests are failing because the code you developed will only work when […]