[Wtr-general] $ie.button replacing with $ie.b?

Charley Baker charley.baker at gmail.com
Sat Jul 7 15:13:27 EDT 2007


I'm not quite sure why you'd want to do that, maybe you could explain it.
Here are a couple of random possibilities:

1. use the string and eval it, makes the code less readable but there are
some good uses for this:
b = "button"
eval("puts $ie.#{b}(:index, 1)")

2.wrap the code in a method, cleaner access and sets you up for methods on
your pages which you can roll into classes for your pages:

def my_form_button; $ie.button(:index, 1);end

puts my_form_button
my_form_button.click

It all depends on what the context of the question is and where you might
want to take it.

-Charley

On 7/7/07, mihai <forum-watir-users at openqa.org> wrote:
>
> cand i do something like this, and how:
>
> b="button"
> puts $ie.b(:index,1)
>
> instead of puts $ie.button(:index,1)
> _______________________________________________
> Wtr-general mailing list
> Wtr-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070707/38c5b538/attachment.html 


More information about the Wtr-general mailing list