I use this code to submit a form using cucumber
When I fill in "Email" with "example@example.com"
And I fill in "Name" with "user name"
Now I want to fill value in a select box.How can I do that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s not code, those are cucumber feature statements. Cucumber will translate those into step definitions, which in turn can contain code that will let you test the thing being described.
You probably have something like web_steps.rb that provides a set of pre-built statements like this, but you should not use them. You should be describing the business behavior of the application you are building, not the low-level UI details. Instead you should write something like this
This gives you an example of what you want to happen when someone signs up (They are logged in automatically and they are thanked for signing up). They way you have it now, you will have to change your specification to match the UI whenever you want to change the name of a field, and the specification should never change unless you are changing your business needs.
So to answer your more technical question, the step definition would look something like this, based on webrat’s documentation