Wasted a couple of hours today on debugging a Geb issue: Navigator.text() was not working as expected.

According to the API docs, it “Returns the text content of the first context element”, but it was returning an empty string for me, even though it was matching an element that had some text within.

In the end, it turned out Navigator.text() returns an empty string if the element it matches is hidden (e.g. it has a display:none CSS style).