Then(/^I check the checkbox called "(.*?)"$/) do |arg1| check(arg1) end Then(/^I uncheck the checkbox called "(.*?)"$/) do |arg1| uncheck(arg1) end Then(/^within "(.*?)" I fill in "(.*?)" with "(.*?)"$/) do |arg1, arg2, arg3| within(arg1) do fill_in arg2, :with => arg3 end end Then(/^within the "(.*?)" number "(\d+)" I fill in "(.*?)" with "(.*?)"$/) do |arg1, arg2, arg3, arg4| items = page.all(arg1) within(items[arg2.to_i - 1]) do fill_in arg3, :with => arg4 end end