minkphp/MinkGoutteDriver

Form Submitting when there are submit buttons with same name attribute

pivica opened this issue · 3 comments

Following up Behat/Mink#212 and opening issue in new Goutte repo.

Is it possible that GoutteDriver can work with input submit elements with same name?

We are evaluating mink testing with Drupal application and problem is that Drupal is always creating form submit buttons with the same name attribute. Typical example

<input id="edit-submit" class="form-submit" type="submit" value="Save" name="op">
<input id="edit-delete" class="form-submit" type="submit" value="Delete" name="op">

And Drupal form api is expecting this situation so I can not change name attributes here to be unique - which means that currently Drupal can not be tested with GoutteDriver.

Can this be fixed?

OK just tested with latest stable behat 2.4.0, mink 1.4.0 and latest dev for GoutteDriver. And it seems that this is fixed now.

We're still having problems with this when we use 3 buttons. We're using something like:

<form method="POST">
    <button name="answer" role="submit" value="yes">Yes</button>
    <button name="answer" role="submit" value="no">No</button>
    <button name="answer" role="submit" value="dontknow">Don't know</button>
</form>

Yes and No work, but trying to submit "Don't know" is submitting "yes".

I'm not sure of the best way to produce a minimal example to test this - I'm using a huge stack based on Symfony Standard edition. What is the minimal setup needed to demonstrate MinkGoutteDriver?

stof commented

See how the driver testsuite is built in Mink: https://github.com/Behat/Mink/tree/master/driver-testsuite