[wtr-general] Re: verify if checkbox is checked

2015-02-17 Thread Chuck van der Linden
On Wednesday, January 28, 2015 at 7:27:23 AM UTC-8, Super Kevy wrote:

 Based on this syntax try:

 label class=custom-checkbox checked data-bind=css: { checked: 
 isDependent() }, click: toggleAsDependent
 spanDependent to an existing member?/span
 input type=checkbox/
 i/
 /label


 @browser.label(:text=Dependent to an existing 
 member?,:class=class=custom-checkbox 
 checked ).exists?
 or 
 @browser.label(:text,Dependent to an existing member?).checkbox.set?


 Not sure why the label is containing the input, that looks weird.



Jack,   did this help you solve your problem?  or are you still struggling 
with this.   (some custom controls like this can be a real pain to test 
against, but there is usually a way around them.

 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
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 watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [wtr-general] Re: verify if checkbox is checked

2015-01-28 Thread 'John Fitisoff' via Watir General
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: jackstaposit...@gmail.com jackstaposit...@gmail.com
 To: watir-general@googlegroups.com 
 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, jacksta...@gmail.com 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
spanDependent 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.
 
watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
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 watir-general+unsubscr...@googlegroups.com.
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.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
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 watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: verify if checkbox is checked

2015-01-28 Thread Super Kevy
Based on this syntax try:

label class=custom-checkbox checked data-bind=css: { checked: 
isDependent() }, click: toggleAsDependent
spanDependent to an existing member?/span
input type=checkbox/
i/
/label


@browser.label(:text=Dependent to an existing 
member?,:class=class=custom-checkbox 
checked ).exists?
or 
@browser.label(:text,Dependent to an existing member?).checkbox.set?


Not sure why the label is containing the input, that looks weird.





On Tuesday, January 27, 2015 at 9:07:30 PM UTC-6, jacksta...@gmail.com 
wrote:

  
 Hi Super Kevy, Thanks for the suggestions.. unfortunately the set? and 
 checked? don't work.
  
 the checkbox, which is the input type=checkbox tag that I indicated 
 before doesn't have any other attributes in it. It is placed as a child of 
 a label control that has all the attributes that I need.
 label class=custom-checkbox -- now this one changes when the checkbox 
 is checked and becomes label class=custom-checkbox checked
  
  
  


-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
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 watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: verify if checkbox is checked

2015-01-27 Thread Super Kevy
Set/Clear

.set? Returns true if the element is checked. alias .checked?
.clearWill 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, jacksta...@gmail.com 
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
 spanDependent 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.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
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 watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[wtr-general] Re: verify if checkbox is checked

2015-01-27 Thread jackstaposition
 
Hi Super Kevy, Thanks for the suggestions.. unfortunately the set? and 
checked? don't work.
 
the checkbox, which is the input type=checkbox tag that I indicated 
before doesn't have any other attributes in it. It is placed as a child of 
a label control that has all the attributes that I need.
label class=custom-checkbox -- now this one changes when the checkbox 
is checked and becomes label class=custom-checkbox checked
 
 
 

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
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 watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.