Set/Clear
.set? Returns true if the element is checked. alias .checked?
.clear Will clear the check.
@browser.checkbox(:id,'sampleId').set?
if @browser.checkbox(:id=>"sampleId").attribute_value('class') ==
"custom-checkbox checked" then puts 'hello' end
myCheckedCheckboxes = @browser.checkboxes(:class,'custom-checkbox checked')
On Tuesday, January 27, 2015 at 2:17:59 AM UTC-6, [email protected]
wrote:
>
> hi! can anyone help me with this one?
>
> got something like this:
>
> <label class="custom-checkbox checked" data-bind="css: { checked:
> isDependent() }, click: toggleAsDependent">
> <span>Dependent to an existing member?</span>
> <input type="checkbox"/>
> <i/>
> </label>
>
> I have a method in ruby for checking the checkbox which works.
> Now on another method, I want to access/see whether the checkbox is
> checked, if yes, I will do something.
>
> checkbox :dependent_checkbox, xpath:
> '//label[@class="custom-checkbox"][contains(@data-bind, "css: { checked:
> isDependent()")]/input[@type="checkbox"]'
>
> def fill_up_form
> if checkbox is checked
> fill-up form
> end
> end
>
> in irb, the checkbox.exists? returns true so I know that the element is in
> the page. but thing is even if I check or uncheck the checkbox, the
> checkbox.checked? always returns false.
>
> another info is, the label class is "custom-checkbox" when unchecked, then
> becomes "custom-checkbox checked" when checked.
>
--
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]
---
You received this message because you are subscribed to the Google Groups
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.