Parameteriz the element being sent by gherkin

I am using pageobjects & want to parameterize the element being passed

Below step works fine:
text_field(:username, :id => “loginUserName”)

And(/^I enter (.*) for username in LoginPage$/) do |data, actual_field|
on_page @current_page do |page|
page.username_element.set data

And(/^I enter (.) for (.) in LoginPage$/) do |data, actual_field|
on_page @current_page do |page|
page.get_element(actual_field).set data

what method should i write to return username_element

def get_element(element_name)
return “#{element_name}+’_element’”

this method returned string “username_element” so it doesnt work.

Any suggestions…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs