0

I am testing page with behat and filling form. I have two password inputs in page html.

First is on top:

<input id="login_password_0" class="form-control " type="password" placeholder="Slaptažodis" autocomplete="off" name="password">

Second at the bottom:

<input id="password" class="form-control validate" type="password" value="" name="password">

Then I run behat/mink test with:

And I fill in "password" with "test"

It fills first one and I need second to be filled.

How to understand documentation, that element can be found and filled by 'id|name|label|value'.

P.S. Changing HTML is not an option.

Safas
  • 43
  • 1
  • 6

1 Answers1

0

Haven't tested but it looks like that Behat is performing a task only once. He has no idea that there could be two elements with the same name. "Name" attribute should be unique for one form. Otherwise, you'll be posting two elements with the same name.

Without fixing your HTML nothing is possible, unless you implement your own test which overcomes this issue. Now "password" is both "id" and 2x "name" attribute. Selector should be unique.