From: wade Date: 2008-02-06T08:44:23+09:00 Subject: Re: how can I use variable as a attribute name 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 On Feb 5, 1:23 pm, Darin Duphorn wrote: > I'm unable to use the attribute name (variable) to verify the button > with the attribute value exists. > > I've tried the following: > > #Set Variables > $attribute_nm = "type" > $attribute_val = "submit" > > #Verify Button Exists > 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? > > Thanks, > > DD > -- > Posted viahttp://www.ruby-forum.com/.