How do I find the first checkbox in Capybara?

Assuming Capybara.default_selector is set to CSS then:

find("input[type='checkbox']")

If you're using XPath it will be different.

Update (June 2013): as @tmg points out, the behaviour for Capybara 2 has changed.


Just to point out tmg's right way to find the first checkbox

first("input[type='checkbox']")

If you want to find n-th checkbox (25-th for example):

find(:xpath, "(//input[@type='checkbox'])[25]")

But it's often better to use within to narrow your searching area

within 'div.div_class' do
  find("input[type='checkbox']")
end