0

I want to know if is possible to pass an object to a step of Behat.

For example, a field of my form will be fill in with a Object. It's fill in with a Object which you can select in a suggestion box. I know the other way with sahi or selenium, but I don't want this, I want a step like this: "When I fill in "field" with object". It's possible?

Sorry if I do not explain it very well.

Biruwon
  • 394
  • 1
  • 4
  • 18

1 Answers1

1

How would you convert a string from Gherkin to an object?

Try argument transformations: http://docs.behat.org/guides/2.definitions.html#step-argument-transformations

However, I doubt you really want to pass an object to a select box (how would you do that in a browser??).

I'd rather use:

I select "Great Britain" from "Country"
Jakub Zalas
  • 35,761
  • 9
  • 93
  • 125
  • The field isn't a select box, the field is a search box. When the user types a letter the field shows some objects that begin whit this letter. – Biruwon Aug 20 '12 at 07:27
  • I'd like to see how "Objects" are shown in a select box. I think you mean string representations of those objects... Anyway, I'm guessing you're working on some kind of autocomplete input field which involves javascript. You'll need to use one of the drivers supporting javascript (like Selenium2) or manually put a value into input box. Autosuggestions usually set a hidden field with an id. You'd need to set it manually as well. – Jakub Zalas Aug 20 '12 at 08:36