I am trying to check my check box in Geb.
I have tried following codes, but no luck
$('input', type:'checkbox', id: 'chkTermsConditions', tabindex: '-1').value('true')
$(".CheckBoxUI").value('true')
Following is the HTML
After mouse go over the check box additional text updated (marked in the screen shot)
I managed to check the check box with
$(".CheckBoxStyle").click()
Only issue is still
Submit
button doesn't get enable. Following is the html code for before and after checking the check box in real situation.I tried the to click on the submit button with following code. It doesn't give any error. But still doesn't move to next page as expected.May be because of
Submit
button disable issue.Edited :
It was turned out above was application related issue. We have to click on the address after selecting via address validation service. Then only
Submit
button get enable.You are attempting to check the box which has the attribute with value='true'
From the Geb manual:
Try this:
$("#chkTermsConditions").value(true)
If you are using non standard HTML generated by some other platform. You may have to resort to clicking the element or using javascript.
The element that produces the desired click result could be one of the surrounding elements. If the widget is javascript controlled you may have to call a function that is embedded into the page for that widget. If its a javascript widget I cannot help you unless you can point me to a page which uses the same platform.
Try:
$('a[class=CheckRadioFocus]').click()
$('a[id=termLink]').click()
or any of the other surrounding elements.