How to Uncheck All checkboxes Using Cucumber/Capybara

Sometimes while automating we need to have  all checkboxes unchecked as a precondition or baseline state in a given page.We can do that in Cucumber/Capybara using following code:

all('input[type=checkbox]').each do |checkbox|
 if checkbox.checked? then
Similar logic can be developed for other types of objects if required or better object type and locator detail can be passed as parameters to achieve higher level of abstraction which will work for any type of objects.


Popular posts from this blog

Testing Webservice with SoapUI Having Windows Authentication

How to Re-run Failed Scenarios in Cucumber

Data Driven Testing Using Selenium -WebDriver in Python