Multiple checkboxes page


Note: Some checkboxes are checked by default

Please select every sport that you play.

Soccer:        
# Here is the HTML code for this text link:
Soccer: <input type="checkbox" checked="yes" name="sports" value="soccer">

# There are several ways of accessing this link
browser.checkbox(:value, "soccer").clear - if you want to set it
browser.checkbox(:value, "soccer").set - if you want to check it
browser.checkbox(:index, 1).set - because its the 1st checbox on the page
# this checkbox hasnt got a class or id
Football:      
# Here is the HTML code for this text link:
Football: <input type="checkbox" checked="yes" name="sports" value="football">

# There are several ways of accessing this link
browser.checkbox(:value, "football").clear - if you want to set it
browser.checkbox(:value, "football").set - if you want to check it
browser.checkbox(:index, 2).set - because its the 2nd checbox on the page
# this checkbox hasnt got a class or id
Baseball:    
Basketball:
snooker:     
Rugby:        
Golf:            
Netball:      
# To set all the checkboxes, we can use a loop
browser.checkboxes.each do |eachCheckBox|
       eachCheckBox.set
end

# To unset all checkboxes
browser.checkboxes.each do |eachCheckBox|
       eachCheckBox.clear
end