Search code examples
grailsgroovymodulegeb

How do I get the base elements attribute in a Geb module


Given the HTML: fooLink

and the page object

class FooPage extend geb.Page {
    static content = {
        foo = { Module FooModule, $('.foo') }
    }
}

What is the correct implementation to get the @href element out of the module?

class FooModule extends geb.module {
    static content = { 
        smartField = { doSomethingSmartWith(?.@href) }
    }
}

I've tried, this, delegate, base, $ and @, none of them work.


Solution

  • Derp, I found it immediately after posting the question. $().

    Here it is in case this helps someone:

    class FooModule extends geb.module {
        static content = { 
            smartField = { doSomethingSmartWith($().@href) }
        }
    }