user2063205
user2063205

Reputation: 21

Selecting radio button in geb

I have 3 radio button in a form with ID, value, and name.

With Geb CSS selector I have tired all combination to click on of the radio button but no success!!

I have tried testBtn {$("input", ID:"resident", name:"status")} then in spec testBtn.value("My status") where radio button value="My status", but label next radio button is "Status". Any help appreciate.

Upvotes: 2

Views: 2733

Answers (1)

erdi
erdi

Reputation: 6954

You probably don't want to use the id in your selector as this would select only one radio. To mark a radio button as selected you set a value on a set of radio buttons with a given name. For your example that would be:

$('input', name: 'status').value('My status')

or if you used content DSL:

static content = {
    status { $('input', name: 'status') }
}

status = 'My status'

Please refer to the section on selecting radio buttons in the Book of Geb.

Upvotes: 2

Related Questions