#passing value instead of constant

search="id"
name="text1"
browser.text_field(search, name).flash #is not working, ERROR:invalid
attribute: "id"

but
browser.text_field(:id, name).flash #working

I want something like the first one where I'll pass a string "id" or
class. Isn't it possible?

···

--
Posted via http://www.ruby-forum.com/.

Is this some kind of rails voodoo? What happens if you switch it to;

search="id"
name="text1"
browser.text_field(search.to_sym, name).flash

Sam

···

On 08/28/2012 06:53 PM, ajay paswan wrote:

search="id"
name="text1"
browser.text_field(search, name).flash #is not working, ERROR:invalid
attribute: "id"

but
browser.text_field(:id, name).flash #working

I want something like the first one where I'll pass a string "id" or
class. Isn't it possible?

In the first example you're using a string, in the second a symbol.

···

2012/8/28, ajay paswan <lists@ruby-forum.com>:

search="id"
name="text1"
browser.text_field(search, name).flash #is not working, ERROR:invalid
attribute: "id"

but
browser.text_field(:id, name).flash #working

I want something like the first one where I'll pass a string "id" or
class. Isn't it possible?

--
Posted via http://www.ruby-forum.com/\.

--
Wysłane z mojego urządzenia przenośnego

-- Matma Rex