You
could add a few simple "unless" clauses, e.g.
def enter_text(arg1, arg2, arg3)
@ie.text_field(:name,
'field1').set(arg1) unless
arg1.nil?
@ie.text_field(:name, 'field2').set(arg2) unless arg2.nil?
@ie.text_field(:name, 'field3').set(arg3) unless arg3.nil?
end
-
Charlie
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Dara Lillis
Sent: Tuesday, February 28, 2006 1:58 PM
To: [email protected]
Subject: [Wtr-general] any way to make IE.text_field.set optional?I'm passing a bunch of text arguments to a method, which will enter them in various fields in a web page. Problem is, I don't always want to enter all the fields, sometimes I only want to enter some of them. Is there an argument I can pass that will tell text_field.set to ignore that particular one?simplified example:def enter_text(arg1, arg2, arg3)@ie.text_field(:name, 'field1').set(arg1)@ie.text_field(:name, 'field2').set(arg2)@ie.text_field(:name, 'field3').set(arg3)endSometimes I will want to enter all 3, but I want to be able to call this method and, say, enter only arg2 and arg3. I've tried passing nil or '' but neither works. I know I can write some code to make this work but I feel I must be missing something obvious, am I?Thanks,-Dara
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
