H H H H - 1 year ago 120
PHP Question

Malformed field path "" (InvalidArgumentException)

I'm using Behat to do some automated Testing and I've added Mink with its Goutte driver.
I'm using the latest version of Behat and Mink.

I've added the Mink Extension to the Feature Context file and it works when I run a simple feature like:

Scenario: See A Blog Post
Given I am on the homepage
And I follow "login"
Then I should be on "/login"
And I should see "Login"

However when I try the next step and try and fill in some fields:

And I fill in "username" with "admin"

Where username:

<input class="input-field" type="text" id="username"/>

I get the following error:

Malformed field path "" (InvalidArgumentException)

Any help will be much appreciated,


Answer Source

This is because you do not have a name="username" attribute on your field. I am having a similar problem but I am trying to test a Stripe instance which you cannot have name attributes. It appears id and title are not working.