Improved warnings if using Pages and input names are 'reserved/inuse' words #122

Closed
geb-bot opened this Issue Oct 7, 2011 · 1 comment

Projects

None yet

2 participants

@geb-bot
geb-bot commented Oct 7, 2011

Originally created by Paul King.

If you have some html like this:

<form name='post' ...>
    <input type='text' name='title' />
    ...

Then trying to have a Page object with the following:

title { $("form").title() }

Will get confused by 'title' as the accessor for getting the browser title. Also, 'content' and possibly others ('at', 'url' not tested).

The workaround is to just use another name but it would be nice if you received a better error message or warning. Currently you receive:
{noformat}
groovy.lang.MissingMethodException: No signature of method: java.lang.String.value() is applicable for argument types: (java.lang.String)
{noformat}

@geb-bot
geb-bot commented Apr 11, 2012

Originally posted by Luke Daley.

We need to have a list of �reserved words� and consult them when parsing the content DSL to fail fast with a nice warning.

We could generate the list by reflecting on the Browser and Page classes, though there would be a performance cost. We might better generating the list and saving as a static data structure.

@geb-bot geb-bot added the Improvement label Apr 12, 2015
@geb-bot geb-bot added this to the 0.10.1 milestone Apr 12, 2015
@erdi erdi modified the milestone: 0.10.1 Jul 11, 2015
@erdi erdi added this to the 1.0 milestone Dec 25, 2015
@erdi erdi self-assigned this Dec 25, 2015
@erdi erdi added a commit to geb/geb that closed this issue Dec 25, 2015
@erdi erdi Throw an exception when a name rendering a content definition inacces…
…sible is being used.

Closes geb/issues#109.
Closes geb/issues#122.
35e3d40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment