Search code examples
jqueryfunctional-testinggeb

Geb hitting dropdown form elements: (error-couldn't select option with text or value)


I'm writing some Geb test for a form. For some reason I can't hit any of the dropdowns in my form.

Example field:

<div class="col-sm-2">
    State<g:select name="submitterState" from="stuff..." class="form-control" optionKey="id" required="" value=""/>
</div>

I've written the test itself three different ways and none of them hit the select. Where 102727 is one of the values of the dropdown.

$('#submitterState').value(102727)
$("form").submitterState = 102727
$('select', name: 'submitterState').value(102727)

Do I have something wrong with my test, or is there something behind it I'm not seeing? -r


Solution

  • First of all, can you select a property with '#'? '#' is used to select an id.

    I think you should pass a string instead of an integer.

    $('#submitterState').value('102727')
    

    But this will not work. You should try something like this:

    $('div.col-sm-2').find('select', name: 'submitterState').value('102727')
    

    Hope, your problem will be solved!