if $ie.button(:$attribute_nm,$attribute_val).exists?
#Verify Button Exists
if $ie.button(:+$attribute_nm,$attribute_val).exists?
#Verify Button Exists
if $ie.button($attribute_nm,$attribute_val).exists?
Wow, that’s a lot of global variables. If it’s a symbol you want:
irb(main):001:0> f = “foo”
=> “foo”
irb(main):002:0> p f.to_sym, f.intern, :"#{f}"
:foo
:foo
:foo
If it’s a method call you’re trying to do based on the variable, see
the Object#send method:
I assume from context that you’re using Watir. I’m pretty sure Watir
is expecting a symbol there for the first argument, which is probably
why your attempts aren’t working. Maybe try using the to_sym method
of the String class, like this:
if $ie.button($attribute_nm.to_sym,$attribute_val).exists?
I assume from context that you’re using Watir. I’m pretty sure Watir
is expecting a symbol there for the first argument, which is probably
why your attempts aren’t working. Maybe try using the to_sym method
of the String class, like this:
if $ie.button($attribute_nm.to_sym,$attribute_val).exists?
Good luck,
wade
Nice! That worked. This will save me tons of extra lines of Code.
Thanks Wade, Your the greatest.
DD
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.