Reputation: 463
I have Geb test in my Grails app that completely misses the form element. I watch the test run and the element itself doesn't fill or run at all. What could I be doing wrong?
Form element GSP:
<div class="form-group">
<label id="business" class="col-sm-2 control-label topsidelabel" for="business">Business</label>
<div class="col-sm-4">
<label id="business-label" class="toplabel" for="business">Name</label>
<g:textField id="business" name="business" maxlength="50" class="form-control" value="${....business}" aria-labelledby="business-label"/>
</div>
</div>
Geb test selector (2 different attempts):
$('#business').value('5150 Studios')
$("form").business == "5150 Studios"
Form HTML:
<div class="form-group">
<label id="business" class="col-sm-2 control-label" for="">Business</label>
<div class="col-sm-4">
<label id="Name-label" class="toplabel" for="Name">Name</label>
<input type="text" name="business" maxlength="50" class="form-control" value="" id="business" />
</div>
</div>
Upvotes: 0
Views: 225
Reputation: 765
You have two elements with the ID business
. When you call $('#business')
geb will return a list of Navigator objects which match the given selector. In this case you are receiving two Navigators back as you have two elements which match the selector. To solve your problem, either rename one of the two business
elements or call:
$('#business')[1].value('5150 Studios')
Upvotes: 2