Maybe something like this would work in determining the checkbox state
b.span(:text, 'Dependent to an existing member?').parent.html =~ 
/custom-checkbox checked/ 

      From: "[email protected]" <[email protected]>
 To: [email protected] 
 Sent: Tuesday, January 27, 2015 7:02 PM
 Subject: [wtr-general] Re: verify if checkbox is checked
   
 HI Super Kevy, Thanks for the suggestions.. Unfortunately, the set? and 
checked? do no work.the checkbox (<input type="checkbox"> does not have any 
other ids or names on it.. the checkbox is placed as a child to a label control 
which has all the attributes, where one is the <label class="custom-checkbox"> 
-- now, this one changes to <label class ="custom-checkbox checked"> when the 
checkbox is checked.   
On Wednesday, January 28, 2015 at 3:50:04 AM UTC+8, Super Kevy wrote:
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.


  

-- 
-- 
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.

Reply via email to