I'm trying to verify the contents of a select box with Geb. I have a solution that works but I feel like there should be a cleaner solution. Some things I've tried don't seem to work though. So this is my solution for now:
In the content part of my page I have this.
// language selector
langSelector { $("#lang-selector") }
langSelectorValues { $("#lang-selector option") }
Then to see if a language is present I'm doing something like this :
// check for english
langSelectorValues.filter(value: 'en')
I guess I was expecting a more direct way to check for the value en directly from the select element (langSelector). This way works, but is there a cleaner way?
You could for example do:
langSelectorFor { value -> $("#lang-selector option[value='${value}']") }
And use it like:
langSelectorFor("en")