I'm trying to perform automated testing using Watir gem. I need to test whether the checkbox works by setting and clearing it.
The HTML for the checkbox is:
<md-checkbox aria-label="Remove" aria-invalid="false" aria-checked="false" tabindex="0" class="ng-pristine ng-valid md-default-theme ng-touched" role="checkbox" ng-model="user.remove_photo" style="margin-top: 0px;">
<div class="md-container" md-ink-ripple="" md-ink-ripple-checkbox="">
<div class="md-icon"></div>
<div class="md-ripple-container"></div>
</div>
<div ng-transclude="" class="md-label">
<span class="ng-scope">Remove</span>
</div>
</md-checkbox>
My test script:
require 'watir'
require 'watir-webdriver/wait'
browser = Watir::Browser.new :firefox
browser.goto 'https://54.69.254.137/webui#/landing'
browser.driver.manage.window.maximize
browser.button(:class =>'sign-in md-button md-default-theme').click
browser.text_field(:id =>'input_001').set('[email protected]')
browser.text_field(:id =>'input_002').set('password')
browser.button(:class =>'md-primary md-raised md-button md-default-theme').click
browser.button(:class =>'md-icon-button md-primary main-menu-toggle md-button md-default-theme').when_present.click
browser.link(:text =>'Edit Profile').when_present.click
browser.checkbox(:class => 'ng-pristine ng-valid md-default-theme-ng-touched').set
browser.button(:class => 'md-primary md-raised md-button md-default-theme').click
Gives following error:
unable to locate element using checkbox(:class => 'ng-pristine ng-valid md-default-theme- ng-touched').