It appears that both of these give me access to the first FORM element in a document:
page.form
page.forms.first
How can I search for a particula开发者_开发知识库r checkbox like
page.form.checkbox_with(:name=>"yep")
if I don't know which FORM it is inside?
Do you want all the forms with that checkbox, or only the first one?
For the first one, do
form = page.forms.detect { |f| f.checkbox_with(:name => "yep" ) }
For all, do
forms = page.forms.select { |f| f.checkbox_with(:name => "yep" ) }
精彩评论