[wtr-general] Re: set or clear Check box with a variable

2011-05-11 Thread Ivan Kabluchkov
emckb = ie.checkbox(:id, 'enableSmtpEmail')

x = :set
y = :clear

emckb.send(x) # Will be set
emckb.send(y) # Will be clear

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


[wtr-general] Re: set or clear Check box with a variable

2011-05-11 Thread Darryl Brown

Željko and Ivan

Both of your solutions work. The one that Željko suggested works the
best for my particular situation as I can use my spreadsheet calls
directly - that's what I was trying to accomplish. I get set or clear
from a spreadsheet.

So, this is working for me now:

 emckb.send ws.Range(k#{row})['Value']



Thanks so much,
Darryl

On May 11, 10:14 am, Vikas Garg vikas22...@gmail.com wrote:
 Brown, using loop in such case will be best as you have to select from 2
 choices.







 -Original Message-
 From: watir-general@googlegroups.com [mailto:watir-general@googlegroups.com]

 On Behalf Of Darryl Brown
 Sent: Wednesday, May 11, 2011 7:39 PM
 To: Watir General
 Subject: [wtr-general] set or clear Check box with a variable

 Hello,

 Is it possible to set or clear a check box with a variable?

 This works -

 emckb = ie.checkbox(:id, 'enableSmtpEmail')

 emckb.set
 emckb.clear

 This does not work -

 x = 'set'
 y = 'clear'

 emckb.x
 emckb.y

 Why ?
 Using a data driven framework and getting the set or clear values from
 a data store. Should something like this work ?

 We have created a method that will do this but wanted to know if this
 can be accomplished in a more direct manner as described above using
 the x and y variables.

 This works OK

 def checkbox_set(box, value)
     if value=='set'
       box.set
     else
       box.clear
     end
   end

 checkbox(emckb,x)

 Thanks,
 Darryl

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

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

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


[wtr-general] Re: set or clear Check box with a variable

2011-05-11 Thread Richard Wijdenes
Darryl

I use this solution:

$br.checkbox(:id, includeSponsor).set if study[includeSponsor] ==
true

R.

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