Hello,

I'm fairly new to Ruby, cucumber, and WebDriver and ran into what
seems to be a Ruby issue. It doesn't seem to be handling my .intern
or .to_sym in this mock-up inline form, ele.send_keys(x[i],
x[i].intern, x[i], x[i].intern)

I tried both intern and to_sym with the same result, as expected.

I'm trying to parse a string and output a string with symbol
parameter.

Input string: 'Student One', :return, 'Student Two', :return
Output: ele.send_keys('Student One', :return, 'Student Two', :return)

def fill_in(field_name,text)
#    ele = Find.Element(find_locator(:text_field,field_name))
#    ele.clear
#The above correctly obtains the text:
#   'Student One', :return, 'Student Two', :return
#Therefore, hard code to test:
   text = "'Student One', :return, 'Student Two', :return"
   items = text.split(/,\s?/)
   ele.send_keys(items.each_index {|x|
     next if x % 2 == 1
     if (x<items.size-1) then items[x] +', ' else items[x] end
                items[x+1].intern
    })
end

Output
'Student One', :return, 'Student Two', :return

When I run this instead of the symbols acting like symbols they act
like strings, the :returns are not resolved.

However, hard coded strings and symbols like the following work as
expected:
ele.send_keys('Student One', :return, 'Student Two', :return)

Output
Student One
Student Two

References:
Send Keys syntax
http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/WebDriver/Element.html#send_keys-instance_method

Keys you can send:
http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/WebDriver/Keys.html

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to