# Setting a checkbox identified by an ID (using Ruby 1.9 hash syntax) browser.checkbox(id: 'checkbox-id').set # Setting a checkbox identified by a class name (using Ruby 1.9 hash syntax) browser.checkbox(class: 'checkbox-class').set
Setting a checkbox is quite straightforward in watir-webdriver. First, the element on the page needs to be found with one of the available methods. Once a reference to the element is available, the set method can be used to set it. The same method is available for radio buttons.