Behat/Mink — Issue #212: GoutteDriver / Submitting when they are many submit buttons
Author: fvilpoix
Created: 2012-03-05 17:52:30+00:00
State: open

Hello,

I have similar issue than #209 and #100 but I don't know if it comes from the same error. If I try to press one of many submit buttons, it always take the first one value, and not the good one (even if I press with id). I think it comes from
https://github.com/Behat/Mink/blob/master/src/Behat/Mink/Driver/GoutteDriver.php#L547

```
if (isset($this->forms[$formId])) {
return $this->forms[$formId][$fieldName];
}
```
Maybe it would be a good idea to store data by field id and not by field name.

How to reproduce :

mink.html

```

```

```
getSession('goutte');
$session->visit($url);
$page = $session->getPage();

$node_field = $page->findById('poney-button');
$this->assertEquals('poney', $node_field->getValue(), 'ok');
}
}
```

```
$ phpunit mink_usecase.php
PHPUnit 3.6.10 by Sebastian Bergmann.

F

Time: 0 seconds, Memory: 11.50Mb

There was 1 failure:

1) MinkTest::testMink
ok
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'poney'
+'jaguar'

[...]/mink_usecase.php:16

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
```

The same happens if you try to press the second button, it will press the first one.

Thanks !